Hi
I offer personalization of a few of my products. How do I display my personalization field only if metafield = true? I have the customization set up in liquid and I’ve assigned my product metafields to be true or false but the product always displays “Personalization” even if the product is set to false.
This product has the metafield set to false, but the box for Personalization still appears.
Here is my code
Personalization Name or Monogram
Clearly, I’ve done something wrong.
Please help!
Thanks
Kelly
Try the value property
{% if product.metafields.my_fields.personalization.value == false %} hidden{% endif %}
https://shopify.dev/api/liquid/objects/metafield#metafield-value
Also make sure everything is the spelling it should be, like if someone else setup personalization it’s could be personalisation.
Then you want to convert the logic to wrap that whole personalization block in the condition as the hidden attribute does not deactivate children, and if a product does not have personalization there’s no point in rendering those elements.
Another approach is to use alternative templates so there is a template for personalizable products and one for products that are not personlized.