@SneakyPete Hi there pls follow this to add product recommendation section.
Step 1: Create a product-recommendations.liquid section
From your Shopify admin, go to Online Store > Themes.
Find the theme you want to edit, and then click Actions > Edit code.
In the Sections directory, click Add a new section.
Name the new section product-recommendations and click Create section.
Replace all of the content with the code below: and save
{% assign heading = ‘You may also like’ %}
{% assign limit = 4 %}
{% if recommendations.performed %}
{% if recommendations.products_count > 0 %}
{{ heading }}
{% for product in recommendations.products %}
-
{% include 'product-card-grid', max_height: 250 %}
{% endfor %}
{% endif %}
{% else %}
{% endif %}
Step 2: Include the section in your product.liquid template
In the Templates directory, open the product.liquid file.
Add the following code at the bottom of the file and save
{% section ‘product-recommendations’ %}
Step 3: Edit your theme.js file
In the Assets directory, open the theme.js file.
Find this line of code:
sections.register(‘hero-section’, theme.HeroSection);
Below that line, add this code:
sections.register(‘product-recommendations’, theme.ProductRecommendations);
Add the following code at the bottom of the file and save
theme.ProductRecommendations = (function() {
function ProductRecommendations(container) {
var $container = (this.$container = $(container));
var baseUrl = $container.data(‘baseUrl’);
var productId = $container.data(‘productId’);
var limit = $container.data(‘limit’);
var productRecommendationsUrlAndContainerClass = baseUrl + ‘?section_id=product-recommendations&limit=’ + limit +
‘&product_id=’ +productId +
’ .product-recommendations’;
$container.parent().load(productRecommendationsUrlAndContainerClass);
}
return ProductRecommendations;
})();
THE END.
If helpful then please Like and Accept Solution.
THANKS