Fetch from Product Feed

findProduct Function

The #findProduct fetches a product from your Product Feed, by using an SKU. By itself, it's a limited function, but when used in conjunction with #includeProducts or #findMatching, it can be a powerful tool for customizing your messages.

Examples

Find a Product by its SKU

The first example shows how to use the #findProduct function to fetch the image link of a users' favourite Product, which has been attached to the User via the User Feed.

{{#findProduct user.[traits.favoriteProductSku]}}
    {{[properties.image]}}
{{/findProduct}}

Get the remaining Stock Count for products in the Cart

The second example shows how to use the #findProduct function together with #includeProducts to show the remaining stock for the three most expensive items in the cart.

{{#includeProducts '{
    "cartProducts": true,
    "options": {
        "maxResults": 3, 
        "sortBy": "properties.price", 
        "desc": true, 
        "distinct": true
        }
      }'
}}
 {{#findProduct [properties.sku]}}
 {{[properties.stockRemaining]}}
 {{/findProduct}}
{{/includeProducts}}

#findProduct extension to search a list (also within another product)

On June 7, we've included an update to our #findProduct function that can enable you to go even further than before by pulling a specific element from a list (or even a list attached to another product). Here's what the list could look like in the product feed:

{
  mainProductSKU: 111111,  
  accessoriesSKUS: 998776, 776655, 223344, 778899
}

This works great with simple cross-selling cases, especially when you'd like your customer to buy accessories for an item or even other related items. Here's an example of how to search within another product:

{{#findProduct [properties.sku]}} <!-- this searches for the main product -->
    {{#findProduct [properties.accessoriesSKUS] itemFromList=0}} <!--this searches within the main product for the first item in the list-->
        {{[properties.name]}}
        {{[product.price]}}
    {{/findProduct}}
{{/findProduct}}

The above example will search the "mainProductSKU" (111111 in our example) and returns the details of the first accessory (itemFromList=0 in our example, which is 998776).

Last updated