Define cart value in shipping_rates.json call

timd
Shopify Expert
121 6 74

Is there a way to define the cart value in an ajax call to shipping_rates.json?

The shipping prices returned are for the cart price without any discounts from discount codes entered in the checkout.

I know it usually doesn't have to account for that because its most often used on the storefront where discount codes have not yet been entered. But I'm working on a customer checkout on a Shopify Plus store.

Ideally I'd like to be able to define a cart value like the code below:

$.ajax({
   url: '/cart/shipping_rates.json', 
   dataType: 'json',
   type: 'post',
   data: {
      "cart":  MyCartValue , 
      "shipping_address": { "zip": $(address_zip).val(), "country": $(address_country).val(), "province": $(address_province).val() } }, 
   success: function(itemData) { 
      console.log(itemData);
   }
}

 

Reply 1 (1)

timd
Shopify Expert
121 6 74

Trying to achieve this also — did you find a solution?