Answers for "Shopify recharge app add to cart button"

0

Shopify recharge app add to cart button

<script>
  $('#add-to-cart-button').click(function(){
    addItemToCart(949931647, 1, "1", "Months")
  });
</script>
<script>
  function addItemToCart(variant_id, qty, frequency, unit_type) {
    data = {
      "id": variant_id,
      "quantity": qty,
      "properties": {
        "shipping_interval_frequency": frequency,
        "shipping_interval_unit_type": unit_type
      }
    }
    jQuery.ajax({
      type: 'POST',
      url: '/cart/add.js',
      data: data,
      dataType: 'json',
      success: function() { 
        window.location.href = '/cart'; 
      }
    });
    window.location = '/checkout';
  }
</script>
Posted by: Guest on October-20-2021

Code answers related to "Shopify recharge app add to cart button"

Code answers related to "Javascript"

Browse Popular Code Answers by Language