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

Commit 43ffb21

Browse files
committed
Adding new section about custom product attributes
1 parent 866f3ef commit 43ffb21

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/recommendations/customize.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ In addition to the `recommendations.html` file, the `ProductRecommendationsLayou
2626
|`web/js`|Contains the JavaScript files that fetch and render recommendations for your store|
2727
|`web/template`|Contains the template for the `magento/product-recommendations` module|
2828

29-
## Customize recommendation unit positioning
29+
## Recommendation unit positioning
3030

3131
When you [create a recommendation]({{ site.user_guide_url }}/marketing/create-new-rec.html), you specify [where you want the recommendation unit to appear]({{ site.user_guide_url }}/marketing/product-recommendations.html#productrecplacement) on your page. For example, you can select to place the recommendations either at the top or the bottom of the main content container. However, you can customize this placement. If you created a recommendation unit for Page Builder, you can use the Page Builder editing environment to customize where you want the recommendation unit to display on the page. For all other page types, you can edit the `*.xml` files responsible for the layout. Magento generates these `*.xml` files when you create a recommendation.
3232

@@ -96,3 +96,13 @@ When you [create a recommendation]({{ site.user_guide_url }}/marketing/create-ne
9696
This change results in your recommendation unit appearing after the product image on the product detail page. If you want the recommendation unit to appear before the `product.info.media`, change the `after="-"` attribute to `before="-"`. The `pagePlacement` argument is an internal argument that should not be modified.
9797
9898
Refer to [layout overview]({{ site.gdeurl }}/frontend-dev-guide/layouts/layout-overview.html) for more information about the types of blocks on the page.
99+
100+
## Product attributes
101+
102+
If you want to draw attention to certain products in a recommendation unit, you can fetch and render any custom product attributes you have defined in the Admin. For example, you can apply a badge in a recommendation unit to indicate a product is on sale:
103+
104+
![Add Badge]({{ page.baseurl }}/recommendations/images/unit.png)
105+
106+
To make sure a custom product attribute in 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.
107+
108+
When this property is set, that custom product attribute is included in the JSON payload when the recommendations service fetches the product data. You can then apply your storefront stylings so that attribute is applied to the product.

src/recommendations/images/unit.png

282 KB
Loading

0 commit comments

Comments
 (0)