I am helping a friend get a Shopify store up and running.
SOME of this products are made in the USA, and not others.
For the products which ARE made in the USA…
how can he display a “Made in the USA” icon in the Product page, and filter by “made in the USA” for searches?
I created a true/false metafield… am I started down the right path?
What’s next?
Hi @Derek_X7 you have started right but you can add tag instead of metafield for the items made in America.
then we can use that tag to show the badge on the product page. please share the store preview URL and location on page where you want to show the badge.
To display a “Made in the USA” icon in the product page and allow customers to filter by “Made in the USA” for searches, you can follow these steps:
-
Create a new metafield in the product page for the “Made in the USA” attribute. As you mentioned, you can create a true/false metafield to indicate whether a product is made in the USA or not.
-
Add the “Made in the USA” attribute to the product page template. To do this, you will need to edit the template file for the product page and add a conditional statement to display the “Made in the USA” icon if the metafield value is true.
For example:
{% if product.metafields.made_in_usa == true %}
{% endif %}
-
Create a collection for “Made in the USA” products. In your Shopify store, create a new collection and set the condition for the collection to include only products where the “Made in the USA” metafield is set to true.
-
Add a link to the “Made in the USA” collection in your store’s navigation menu. This will allow customers to easily find and filter for “Made in the USA” products in your store.
I hope this helps! If you want I can setup this for you. Just let me know.
Hello @Derek_X7
It’s GemPages support team and glad to support you today.
You can use true/false metafield
After copy the code of this metafield:
‘product.metafields.custom.made_in_usa’ - The code is taken above, put it in the same position as the code below:
{% if product.metafields.custom.made_in_usa == false %}
//Show code icon
{% endif %}
Hope my solution can work and support you!
Kind & Best regards!
GemPages Support Team.