Hide add to cart button when First Variation Is selected from drop down shopiy

203 views Asked by At

When User select first option from the product variations, hide the add to cart and PayPal buttons otherwise show both buttons.

  $(document).ready(function(){
      $("select.single-option-selector").change(function(){
          var first = $(this).children("option:selected").val();
          var second = $('option:eq(0)').val();
     if (first == second){
           $("#addToCart-product-template").hide();
           $(".shopify-payment-button__button").hide();
  }
  else{

           $("#addToCart-product-template").show();
           $(".shopify-payment-button__button").show();
  }

      });
  });
0

There are 0 answers