Customisation Guide
In this guide we will update our store to exclude certain products from Shopify's default product recommendation section.
β
In this guide:
We will duplicate our stores theme.
We will edit our themes product-recommendations.liquid file to ignore products with a certain tag from outputting in product recommendation sections.
This is an advanced guide intended for developers
Before we begin
This guide involves editing theme code. If that is not your cup of tea feel free to reach out to the Biscuits Bundle team to help you out!
β
Quick note
Shopify does not have an automatic tag value, metafield to help exclude a product from your stores product recommendations. The seo.hidden
metafield is used to hide products from search results but does not affect product recommendations. Instead you will need to either adjust some code in your stores theme with a tag (explained in this guide) or manually set the recommended products in the Shopify search and discovery app.
1. Create a development theme
First we will create a development theme so any changes we make DON'T appear on your live store until we have tested and are happy with them.
Open Online Store > Themes in Shopify admin and click the three dot menu next to customise on your published theme, then choose "duplicate".
Click the three dot menu on this copied theme and rename it i.e "Dawn | Biscuits Customisation"
Then using the three dot menu again, click "edit code" on our new development theme.
2. Find the related-products.liquid file (or similar)
Now we need to find the correct related-products.liquid file to edit in your theme.
Because every theme can be different, the file you edit for this step may vary a lot.
We are using Dawn theme for the example today.
Because every theme can be different, the file you edit for this step may vary a lot.
1. Use the search bar in the top left to search "related-product" and look inside the sections folder.
You should see a related-products.liquid
3. Update your related-products.liquid file
Now we have the correct file we need to update the recommendations.products loop to ignore products with the tag 'hidden'
1. Search for recommendations.products
the code may look similar to this,
{% for recommendation in recommendations.products %}
2. Paste the following code under this for
tag, effectively telling the loop to skip products with the tag 'hidden'.
{% if recommendation.tags contains 'hidden' %}{% continue %}{% endif %}
3. Tag the product
Now we will tag the products we don't want included in the Shopify recommended products section.
1. Find your product in Shopify admin > products
2. Add the 'hidden' tag to your product
3. Hit save
β
4. Check the product is no longer outputting in recommended products
Preview your development theme and visit the product page where the product was displaying as a recommended product
Confirm it is no longer displaying
5. Publish development theme
Once you have tested your code changes on your development theme thoroughly, you can publish this theme to be live!
This will make your changes published and visible to your customers.
Conclusion
Thats it! If you made it to the end successfully well done! If not, don't be afraid to reach out to the Biscuits Bundle team for help.
Stuck or got questions?
Use the chat widget below, or reach out to us at [email protected]
Happy coding, and thanks for teaming up with Biscuits Bundles!