All things Shopify and commerce
Hello,
I'm facing an issue, I've successfully set up custom size regions for specific collections on my store (for example, for the 'Nike' collection), and they are working perfectly. These collections now display sizes in multiple regions (UK, EU, US) as intended, and the experience is seamless for customers browsing those specific products.
However, I'm encountering an issue with my other collections that (GUCCI, LV DIOR ect), that are not targeted for custom regions. Instead of displaying the default sizes for those products, the size grid appears blank. I'm looking for a way to ensure that non-targeted collections show the default size variants as expected, rather than a blank grid.
Could anyone guide me on how to fix this issue? Any help would be greatly appreciated!
Thank you in advance for your support.
Link:https: //97ee47882ybye2r0-64748617967.shopifypreview.com
Since it's your custom code, it's hard to suggest any fixes without seeing it.
Looks like the buttons work as intended, it's just there is no text output inside the buttons...
Hi Tim,
Thanks for your reply.
The collections I’ve targeted to show custom regions are displaying perfectly with UK, EU, and US sizes here are a few working examples for reference:
However, for collections that I haven’t targeted for custom regions such as GUCCI, LV, and DIOR the size grid appears, but the buttons show up blank with no text inside.
It seems the default variant.title isn't rendering inside the button. I'm trying to make it so that if a product isn't part of the custom collections, it simply displays its default size titles as buttons (like Small, Medium, 42, etc.).
Here’s a link to one of the non-targeted collections that’s showing blank buttons:
Here is the HTML and Java im using to target collection
Would you be able to point out what could be causing the sizes not to display inside the size buttons for these default collections?
Thanks again for your time and help!
My understanding is that product always has UK size -- it's the variant title?
Here is your code, simplified:
{% for variant in product.variants %}
{% if condition A ... %}
{% assign uk_size = ... %}
{% assign us_size = ... %}
{% endif %}
{% if condition B %}
...
{% endif %}
{% if uk_size != "" %}
<button>{{ uk_size }}</button>
{% endif %}
{% endfor %}
There are two things:
1. Note that if no conditions are met, the uk_size is not assigned and therefore it's empty, however empty !="" either, so the button is output, but it is empty.
2. The condition does not depend on a variant -- you're checking the product.title, there is no need to do it for each variant.
You should do it outside the loop and do something like below.
{% if condition A %}
{% assign type = "adidas" %}
{% elsif condition B %}
{% assign type = "nike" %}
{% elsif ... %}
...
{% else %}
{% assign type = "other" %}
{% endif %}
{% for variant in product.variants %}
{% assign uk_size = variant.title | upcase | remove: "UK" %}
{% assing us_size = "" %}
{% assing eu_size = "" %}
{% case type %}
{% when "adidas" %}
{% assign uk_size = ...%}
{% assign us_size = ...%}
{% when "nike"%}
...
{% else %}
{% endcase %}
{% if uk_size != "" %}
<button>
{% endif %}
...
{% endfor %}
Note that in my code I reset XX_size variables first thing in each loop.
And uk_size is always assigned variant title, so there is always something to show.
Also, ideally, you should set either Vendor or Type on your products, then simply check , say
{% if product.type == "adidas sneakers" %} ...
And, this way you can use this to determine if it's necessary to show the "UK/US/EU" selector.
Hi,
I appreciate your help so far, but I'm not entirely sure what to do with the code you provided. Could you please send me the final code that I should add to my store to achieve the following:
For products that are not part these collections (all other products), display only the default size (without region buttons).
If you could provide me with the full working code ready to be implemented, that would be really helpful.
Thanks so much!
Do you really expect me to retype all the stuff from your screenshot?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025