We have a metafield called market.metafields.custom.available_product_variants which contains a list of variants for particular international markets. and no matter what we try we seem unable to apply a filter to it to reduce the number of items returned to get under the Shopify 50 limit.
We can assign localization.market.metafields.custom.available_product_variants.value (using localization to get a specific market) as so:
{% assign selected_variants = localization.market.metafields.custom.available_product_variants.value %}
and then we can loop through the array using FOR to output:
{% for variant in selected_variants %}
Market Variant ID: {{ variant.id }}
Market Variant Title: {{ variant.title }}
Market Variant Product ID: {{ variant.featured_image.product_id }}
Product ID: {{ product.id }}
{% endfor %}Weâre including the product.id in order to check that we can output that as well - and it outputs as expected
Weâve tried numerous different ways and followed the documentation https://shopify.dev/docs/api/liquid/filters/where but nothing seems to work, as soon as we try and add a where filter - it stops working.
i.e.
#1 -With quotes for property name and double quotes for the value
{% assign selected_variants = localization.market.metafields.custom.available_product_variants.value | where: âfeatured_image.product_idâ, âproduct.idâ %}
#2 - Without quotes for property name and double quotes for the value
{% assign selected_variants = localization.market.metafields.custom.available_product_variants.value | where: featured_image.product_id, âproduct.idâ %}
#3 - With the full variant name, quotes for property name and double quotes for the value
{% assign selected_variants = localization.market.metafields.custom.available_product_variants.value | where: âvariant.featured_image.product_idâ, âproduct.idâ %}
#4 -With the full variant name, without quotes for property name and double quotes for the value
{% assign selected_variants = localization.market.metafields.custom.available_product_variants.value | where: variant.featured_image.product_id, âproduct.idâ %}
What are we doing wrong?