Thanks for your post. The [CarrierService API] does not currently have a way to provide information about cart level discounts in the information sent to the callback url.
Itās important to keep in mind that buyers can still add or remove discount codes on the payment step of checkout after the CarrierService API has acquired a rate on the shipping step so the total cart price could still change after that shipping price has been selected.
Thanks for your reply. Currently the information the CarrierService API sends to the callback url has a āpriceā field for each line item, and that āpriceā field shows the regular price (with no discounts at all) of a single instance of that line item without a decimal.
It wasnāt mentioned in this thread but the āgramsā field also only shows the weight of a single instance of the line item.
So for example if the itemās regular price is $1.00, each weighing 50 grams and the order contains 5 of them, the related data for that line item sent to the callback url would be like: āpriceā=>100, āquantityā=>5, āgramsā=>50
Hi, we are sufferring with this issue too. How would you propose a store could (consistently) offer free shipping when the order total is over a certain amount? At the moment, if a discount applies that takes an order back below a threshold, the customer still (incorrectly) would get free shipping.
Iāve faced this issue when I started developing Shopify Apps two and a half years ago, and at that time it was a known issue for years (Thread link for additional context: Discount info missing in shipping calculate webhook - Shopify Community)
I came here today to check if there was any updates regarding this, but things seems to be the same.
We found a solution that worked for us since we are the developer of both our own CarrierService app and our storeās theme. We noticed that properties: {} was being passed to our quote endpoint which gave us the idea to set private line item properties via the Ajax Cart API on the cart page for items adjusted via automatic discounts.
Any item in the cart that has a discounted_price lower than price gets a _discounted_price line item property set. This gets passed through to the quote and used in place of the price, if it exists on that item, otherwise it just falls back to the regular item price.
The only real downsides are:
relying on the JS call to cart/change.js for this to work.
The visual display of the property showing up on orders in the admin (see image attached below).
The discounted_price doesnāt always round exactly the same from the cart calculated value to the end result in checkout / admin.
// Example call to cart/change.js from cart page
jQuery.post(window.Shopify.routes.root + 'cart/change.js', {
line: item.index,
quantity: item.quantity,
properties: {
'_discounted_price': item.discounted_price
}
});
Adding or removing discount code in checkoutās payment step still sends the information to the callback url and shipping rate in checkout is updated. Itās just totally useless as the discount doesnāt show up in the payload. I just canāt understand the reasoning behind this. It would be very important to know what the customer is actually paying for the product when calculating the rate for shipping.