Minimal Theme - Remove 'Size: NOSIZE' varient from showing when no size option available

BestGift
Excursionist
19 0 5

Help Needed Please.

I am on Minimal theme and whenever I show products that have no sizes to display there is a 'size NOSIZE' dropdown that shows.

Screenshot below.

Screenshot 2021-01-30 at 19.53.08.png

 

I would like to see if there is a way I can make sure that the size dropdown doesn't show when there are no sizes available.

Is this possible at all?

https://purestylecollection.com/collections/mens-watches/products/kom-w3012

Thanks in advance for the help, if anyone can offer any?

0 Likes
florinanghel
Shopify Partner
102 15 17

You could remove the size option on the product from the admin if it is not needed.

0 Likes
BestGift
Excursionist
19 0 5

Thank you for your reply.

I know that there is a way to manually remove the size Variant on each product through admin.

I'm looking for a way, in code, to make it so that it is automatically hidden on my website if there is no size options available.

 

Thanks

0 Likes
florinanghel
Shopify Partner
102 15 17

But there is a size option, that is how nosize was added, as a nosize option.

Assuming when nosize exists its alone you could use this js:

 

 

$('[value="NOSIZE"]').closest('.selector-wrapper').hide();

 

That could go in your theme.js right after

var selectCallback = function(variant, selector) {
        self.productPage({
          money_format: theme.moneyFormat,
          variant: variant,
          selector: selector,
          translations: {
            add_to_cart: theme.strings.addToCart,
            sold_out: theme.strings.soldOut,
            unavailable: theme.strings.unavailable
          }
        });
0 Likes
BestGift
Excursionist
19 0 5

Thank you for your reply and your help.

That has worked in removing the size NOSIZE perfectly, but it has also removed the colour Variant. Example below.

 

Screenshot 2021-01-31 at 11.24.52.png

Is there any way to just isolate the 'size' = NOSIZE and leave the colour Variant showing, even if it is just the 1 colour. ie. black in this example. Screenshot below

Screenshot 2021-01-31 at 11.28.37.png

 

 

Thank you again for your help.

 

0 Likes
florinanghel
Shopify Partner
102 15 17

Thats odd, the code is just for nosize, I can't see what I might be missing.

0 Likes