Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 4303c35

Browse files
authored
Merge pull request magento-commerce/devdocs/pull#2805 from magento-devdocs/em_prex-custattributeupdate
Updating custom attributes
2 parents 9a45140 + 9f9acc8 commit 4303c35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/recommendations/customize.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,13 @@ Refer to [layout overview]({{ site.gdeurl }}/frontend-dev-guide/layouts/layout-o
101101
102102
Developers often need access to custom product attribute values in recommendations units on storefronts so that they can add visual treatments to products based on those attributes.
103103
104-
For example, if your store sells some organic products, you might have a custom attribute on those products designating them as `Organic = true`. You may need access to this attribute value on the storefront so that you can give these products special visual treatment when they appear in Recommendations. Similarly, access to these custom product attribute values allows you to badge products or drive custom logic in the presentation layer of your site.
104+
For example, if your store sells some organic products, you might have a custom attribute on those products designating them as `Organic = Yes`. You may need access to this attribute value on the storefront so that you can give these products special visual treatment when they appear in Recommendations. Similarly, access to these custom product attribute values allows you to badge products or drive custom logic in the presentation layer of your site.
105105
106106
![Add Badge]({{ page.baseurl }}/recommendations/images/unit.png)
107107
108108
To make sure a custom product attribute is available when you render the recommendation unit on the page, set the `Used in Product Listing` property to `Yes` in the [Product Attributes](https://docs.magento.com/user-guide/stores/attribute-product-create.html#step-4-describe-the-storefront-properties) page in the Admin.
109109
110-
When this property is set, that custom product attribute value is included in the JSON payload when the recommendations service fetches the product metadata. You can then apply custom storefront styling based on this attribute value.
110+
When this property is set, the JSON payload includes an `attributes` object that contains an array of attribute codes and values. You can then apply custom storefront styling based on these attribute values, such as adding special visual treatments or badges as mentioned previously.
111+
112+
{:.bs-callout-info}
113+
Product attribute changes can take up to an hour to appear in the JSON payload.

0 commit comments

Comments
 (0)