How to disable the auto-selection of product variants In Lammar Theme

How to disable the auto-selection of product variants In Lammar Theme

almahmud1
Shopify Partner
4 0 2

Hi

How to disable disable the auto-selection of product variants In Lammar Theme.

Thank you advance.

Replies 2 (2)

shahrozbabar5
Trailblazer
202 20 25

Hi @almahmud1 ,

Locate the JavaScript or Liquid File Handling Variants:

  • Look for the JavaScript that controls variant selection. It might be in Assets under a file like theme.js, product.js, or another similarly named file.
  • Alternatively, the code could be in a Liquid file within Sections or Snippets, such as product-template.liquid or product-form.liquid.

5. Identify the Auto-Selection Code:

  • Search for the code that sets the selected variant when the product page loads. Look for something like:

 

var firstAvailableVariant = product.variants.find(variant => variant.available);
if (firstAvailableVariant) {
    selectVariant(firstAvailableVariant);
}
​

 

  • Comment out.

    If it resolves your issue, please mark my answer as a solution or if you still need assistance, let me know. Thank you.



Need a Shopify Expert and Specialist? Let's chat on WhatsApp and bring your vision to life!


Custom Shopify Store Design | Premium Themes | Variant Apps Expert


Your Coffee Tip and my code, a seamless synergy. ❤️

almahmud1
Shopify Partner
4 0 2

almahmud1_0-1723403752116.png

I found this one, I didn't found the code that you sent.