Currently I’m trying to migrate my shop from WooCommerce to Shopify.
I’m selling collectible items that have some custom metafields. One examples:
hsmc_meta.scale that has three attributes: title, description and seo_description.
Title might be: ‘1:6’ or ‘1:1’ and the corresponding description: ‘sixth-scale’ or ‘lifesize’.
Now I have setup a page/template for the scale and I want to display all products that have the scale set up. So it should be URL.com - MediaOptions and there I want to list all the lifesize items. I need it for obvious SEO reasons.
It seems daunting that I’m trying for over 2 weeks to achieve something in Shopify that is enabled in WooCommerce by default.
This is the code I tried so far, with help of ChatGPT, but without any success, Shopify simply does not find the products:
{% assign scale_value = request.path | split: '/' | last %}
{% assign matching_products = collections.all.products | where: "metafields.hsmc_meta.scale.description", scale_value %}
{% if matching_products.size > 0 %}
{% for product in matching_products %}
## {{ product.title }}
{{ product.price | money }}
{% endfor %}
{% else %}
No products found with the scale "{{ scale_value }}".
{% endif %}
Alternatively I tried to use collections, but I can’t make automated collections based on metafields. The only “quick” solution would be to put every single attribute of the item into tags. But it seems… quite profane.
Let’s say I have further follwing attributes:
Manufacturer, Franchise, Scale, Current Warehouse, Edition/Version
Is really the only solution to mantain every value of the attributes above via tags and then list everything using collections?