Remove dropdown menu with only one option

Solved
nndbrgs
Tourist
4 0 0

Hello.

I'm building a dropshipping store and almost all of my products have multiple variations of colors and sizes, most of them are shipped from a lot of countries too.

The thing is, I'm only buying the products from China and even when I delete all the "Ships from" variations it keeps appearing on the products pages with only one option to be selected.

I've tried the solutions @Nitin_Kujur 

 

 

 


 

 

 

 

 

 

 

 

0 Likes

This is an accepted solution.

Try to add the JS script to the end of theme.js

$(document).ready(function(){
    for (const select of $(".template-product select")) {
         if ($(select).children().length == 1) {
            $(select).closest(".selector-wrapper").hide();
         }
    }
})
Visit my Shopify Youtube channel to learn how to code your Shopify store and fix various coding issues on Shopify.(subscribe if you like it :)).
Glad to help out and wish your Shopify store great success.
nndbrgs
Tourist
4 0 0

Woooah, that worked almost perfectly. Thank you so, so much!

Just a perfectionist question, the dropdown menu is visible for something like a second when I open the page, is it possible to make it invisible even for this period of time?

 

I know it's a silly question, but as I've said, I'm a perfectionist. But your answer helped me a lot already. Thank you again

0 Likes

It is a client side solution, so I don’t think it is possible to make that perfect but it depends on the network speed, if everything loads fast, it is hard to notice. 

If you have any problems in the future for your Shopify, you can visit my YouTube channel, I am keeping posting videos on how to fix different problems on Shopify store, you may have some thing useful there   https://youtube.com/channel/UCxx8s_d6t_RKNqHrp-4bpvQ

 

Visit my Shopify Youtube channel to learn how to code your Shopify store and fix various coding issues on Shopify.(subscribe if you like it :)).
Glad to help out and wish your Shopify store great success.
nndbrgs
Tourist
4 0 0

No problem @DeepCode. And thanks again for your help.

0 Likes
Bflaherty03
Excursionist
20 0 2

Is there a way to do this in the Debut theme? 

0 Likes

@Bflaherty03 it should work for debut theme

Visit my Shopify Youtube channel to learn how to code your Shopify store and fix various coding issues on Shopify.(subscribe if you like it :)).
Glad to help out and wish your Shopify store great success.
0 Likes
Bflaherty03
Excursionist
20 0 2

Unfortunately that did not work. I edited theme.js and added that code to the bottom but it did not change anything.

0 Likes