Hide product based on metafield property.

New Member
7 1 0

Hi there, I am creating product variants at discounted price to offer based on certain conditions. I'm doing this with the API and appending a metafield property "hidden": true for this variants.

I need to hide from all the pages in my store all the product variants tagged with the hidden property on metafields.

Is there any way to do this?

Thanks in advance.

Shopify Partner
1151 131 196

I assume you are mostly interested in hiding the variants on product pages. In that case you locate the liquid file responsible for displaying product variants on your product page (theme specific) and use liquid code to exclude the variants when rendering the variants dropdown. You might also want to ensure there are no AJAX calls to Shopify to populate the variants dynamically, in that case you might need to do the filtering/hiding for the results received.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog