How can I hide unavailable variants?

How can I hide unavailable variants?

vancouver_k
Excursionist
26 0 9

Hi there,

 

I have to lists of variants - frame type and frame size. Some frames come in different sizes from others so when a customer selects the frame type I only want the relevant sizes to be in the 'size' dropdown.

 

Currently it has a long list of sizes with loads of them crossed out, but I would like the crossed out sizes to be hidden so it's tidier and less confusing.

 

Could anyone advise what code would work for this and where to put it please? My theme is craft. Thank you

 

 

Replies 9 (9)

Moeed
Shopify Partner
7345 1991 2429

Hey @vancouver_k 

 

Share your Store URL and Password if enabled.

 

Best Regards,

Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


vancouver_k
Excursionist
26 0 9

Hi there,

 

it's https://225e55-80.myshopify.com/products/personalised-80th-birthday-typography-print-test

 

PW is sduhsdjvdfhb

 

this is just a test product while I am figuring out how to do this

 

Thank you

Moeed
Shopify Partner
7345 1991 2429

Hey @vancouver_k 

 

Follow these Steps:

1) Go to Online Store
2) Edit Code

3) Find theme.liquid file

4) Add the following code in the bottom of the file above </body> tag

<script>
document.addEventListener("DOMContentLoaded", function () {
    const select = document.querySelector(".select__select");

    if (select) {
        Array.from(select.options).forEach(option => {
            if (option.textContent.includes("Unavailable")) {
                option.style.display = "none"; 
            }
        });
    }
});
</script>

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


vancouver_k
Excursionist
26 0 9

Thank you! I will try it later on today and reply/mark as a solutions

 

i have asked another question and wondered if you new about this at all:

https://community.shopify.com/c/shopify-design/help-with-using-metafields-to-copy-product-variants-t...

thank you

vancouver_k
Excursionist
26 0 9

Hi there,

 

for some reason this hasn't worked. Any ideas how to fix it please?Screen Shot 2025-03-31 at 08.19.50.pngScreen Shot 2025-03-31 at 08.17.54.png

Moeed
Shopify Partner
7345 1991 2429

Can you share your collaborator code in my private messages so that I can have a proper look at it?

 

Best Regards,

Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


Easify-Jolie
Shopify Partner
262 9 25

Hi @vancouver_k 

I recommend using Easify Product Options! It’s a no-code, easy-to-use solution that lets you show only the relevant frame sizes based on the selected frame type and automatically hide unavailable options. This keeps your size dropdown clean and user-friendly—no more crossed-out options! Here's how it works: 

  • This is the result:

EasifyJolie_5-1743406958856.png

 

EasifyJolie_4-1743406940063.png

 

  • This is the app setting:

EasifyJolie_3-1743406909058.png

 

EasifyJolie_7-1743407047526.png

 

To ensure that when a customer selects the frame type, the relevant sizes to be in the 'size' dropdown—you just need to enable Conditional Logic in the Advance Settings and set it like this:

 

EasifyJolie_6-1743407025410.png

 

Also, if you want the crossed out sizes to be hidden so it's tidier and less confusing, you can go to Setting in the Easify app, and set the Out-of-stock options to Hide options.

EasifyJolie_8-1743407212034.png

 

You’ll find this app easy to use, so I hope you give it a try. If you need assistance, just let me know or reach out to Easify! 🤗

Easify Product Options: Any product options app can help you create custom options, but Easify turns those options into sales and conversions!
Easify Inventory Sync: Automate inventory syncing for Bundles, Duplicates, and Raw Materials. Say goodbye to manual tracking headaches.
Easify Product Attachments: Enrich your store with downloadable content. Easily add PDFs and other files to product or any page.
>>> Try Apps for Free | 24/7 Live Chat Support
vancouver_k
Excursionist
26 0 9

I just want to add some code to my site but I'm sure the app is great.

 

If anyone can tell me what the correct code would be I'd be most grateful. Thanks

Korben
Visitor
1 0 0

I'm having the same issue, tried a couple of bits of code but doesn't work, perhaps they are for previous template versions.