adding script in vat for product order shopify

44

<script>
var selectCallback = function(variant, selector) {
  if (variant && variant.available) {
    // valid variant selected
    $('#add-to-cart').removeClass('disabled').removeAttr('disabled').val('Add to Cart'); // remove unavailable class from add-to-cart button, and re-enable button
    if (variant.compare_at_price == 0){
      $('.product-title .price').html(''+Shopify.formatMoney((variant.price*1.2), "{{shop.money_format}}")+' Excluding VAT');
    } else {
      $('.product-title .price').html('<span>'+Shopify.formatMoney((variant.price*1.2), "{{shop.money_format}}") + '</span> <del>' + Shopify.formatMoney(variant.compare_at_price, "{{shop.money_format}}") + ' Excluding VAT</del>');
    }
  } else {
    // variant doesn't exist
    $('#add-to-cart').addClass('disabled').attr('disabled', 'disabled').val('Sold Out'); // set add-to-cart button to unavailable class and disable button
    var message = variant ? "Sold Out" : "Unavailable";
    $('.product-title .price').text(message); // update price-field message
  }
};

Comments

Submit
0 Comments