---
schema_version: "1"
id: 336530bb37c3fca78b256e50e5975569b430a03f281b75a83897570c16a8927f
title: Developer Considerations for Einstein Product Recommendations
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/b2c-commerce/guides/recommendations/b2c-developer-considerations-for-predictive-recommendations.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/b2c-developer-considerations-for-predictive-recommendations.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 625db8bf10b2bc92c57c1d04cb731480141fd2f053a1a60e85eb5d16432a6148
products:
  - Composable Storefront
  - Salesforce APIs
---
# Developer Considerations for Einstein Product Recommendations

To implement Einstein Product Recommendations, modify ISML templates, define content slots, provide a unique ID, and make other customizations.

When you implement Einstein Product Recommendations, keep these points in mind:

- Modify ISML templates to define content slots and show Einstein Product Recommendations.
- When you define content slots for Einstein Product Recommendations, give the slot a unique ID and set the `context` to global.
- If the content slot renders recommendations on product detail or category-landing pages, include the referring product ID or category ID as part of the `context-object` attribute.
- Pass the `context-object` attribute a basket or `dw.util.Collection` of products. This option creates and uses recommendations based on selected products (up to 5), or all products in the basket.

This example `<isslot>` tag shows how to define a slot for use on a product detail page:

```xml
<isslot id="myslotid" context="global" context-object="${pdict.Product}"/>
```

This example shows how to define a slot for use on a category landing page:

```xml
<isslot id="cat-banner" context="category" context-object="${pdict.ProductSearchResult.category}" />
```

For defined content slots on your storefront, make sure to create a page template to render the recommended products. If you already have a template that renders other types of product content slots, reuse these templates with some modification. When reusing a template, copy it to the `/templates/default/slots/recommendation/` folder.

This example shows a product template for Einstein Product Recommendations:

```xml
<iscontent type="text/html" charset="UTF-8" compact="true"/>
<iscomment> should not be cached, the tiles are cached individually.</iscomment>

<isif condition="${slotcontent}">
<div class="product-listing product-listing-1x4">
        <h2>${slotcontent.calloutMsg}</h2>

        <ul class="search-result-items tiles-container">
                <isloop items="${slotcontent.content}" var="product" begin="0" end="3">
                        <isobject object="${product}" view="recommendation">
                                <li class="grid-tile">
                                        <isinclude url="${URLUtils.url('Product-HitTile',
                                                'pid', product.ID,
                                                'showswatches', 'true',
                                                'showpricing', 'true',
                                                'showpromotion', 'true',
                                                'showrating', 'true')}"/>
                                </li>
                        </isobject>
                </isloop>
        </ul>

</div>
</isif>
```

When you develop slot-rendering templates for Einstein Product Recommendations, don't cache the entire slot. Einstein Product Recommendations are dynamic, so caching the entire slot shows the same recommendations to every visitor. Cache individual product tiles instead of the entire template.
