What's your biggest current challenge? Have your say in Community Polls along the right column.

How can I fix a meta field bug affecting my product size guides?

How can I fix a meta field bug affecting my product size guides?

SofiaN1
New Member
9 0 0

Tried to add meta field with size guide on my products. But the same size guide shows up on ALL of my products. For example....there is suppose to be one size guide for tshirts and a different one for hoodies. But when i add it on one tshirt then it ends up on every product. Even the on the pants. I was told its a bug in the theme. Can someone explain to me step by step how i remove this bug???

Replies 3 (3)

Moira
Shopify Staff (Retired)
2118 231 337

Hey @SofiaN1!

 

To remove the bug in your theme that causes the same size guide to show up on all products, you'll need to make some changes to your theme code. Here are the steps:

 

  1. Go to the Shopify theme editor.
  2. Locate the templates file responsible for displaying the product details, usually it's product.liquid or product-template.liquid.
  3. Look for the code that is responsible for showing the size guide. It should look something like this:
{% if product.metafields.size_guide %}
{{ product.metafields.size_guide }}
{% endif %}
  1. To make the size guide specific to each product, you'll need to add a conditional statement that checks the type of product and displays the corresponding size guide. You can add the following code:
{% if product.type == 'T-shirt' and product.metafields.tshirt_size_guide %}
{{ product.metafields.tshirt_size_guide }}
{% elsif product.type == 'Hoodie' and product.metafields.hoodie_size_guide %}
{{ product.metafields.hoodie_size_guide }}
{% endif %}
  1. Repeat the same process for each product type, adding the corresponding metafields to the conditions.
  2. Save the changes and test on your live store to ensure the issue is resolved.

Note: Make sure to back up your theme code before making any changes.

 

I hope this helps! Let me know if you need further assistance.

Moira | Social Care @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog

SofiaN1
New Member
9 0 0

Hi and thank you. However, there are not any product.liquid or product-template.liquid. I have checked through every section on theme, even made a search. I cant find any product details. There are not any metafields there either.

SofiaN1
New Member
9 0 0

There is not any specific product details in theme. So i cant find anywhere to change this coding. The metafields are not shown in theme at all.