Access through API the order totals with discounts BEFORE the order is finalised by the customer

Brainblend
New Member
2 0 0
Hi Everyone
 
Is there someone what can help out with this? 
 
How to access through API the order totals with discounts BEFORE the order is finalised by the customer, to check if the amount for free shipping is reached.
 
Problem details:
When a customer adds 2 or more products to their cart, the app QD (Quantity Breaks/Discounts) calculates a discount which gives an order total discounts included.
 
A shipping app ( CSL Nordic Shipping options) apparently does not have access to this discounted amount from Shopify. It is given the total without discount, so it gives free shipping based on a wrong total. This means free shipping is given at times, when it is not supposed to be given.
 
I have talked to both app developers and they say it is something in Shopify that has to be fixed.
 
I have talked with Shopify and they say it looks like the API isn't getting the correct information from the order page. However they can't support API questions as they don't have in-depth grasp of the API system.
 
Can anyone here help out on this?
 
Best, Ida 
Replies 8 (8)
Gregarican
Shopify Partner
1030 86 276

I'm not sure how your shipping provider is getting these details (e.g. - a webhook response, an API request, etc.) but if it's a webhook then discounts are passed along with the orders/create response. See https://shopify.dev/docs/admin-api/rest/reference/events/webhook for details. If you look at the sample response, you will see it contains anything/everything about the new order. There is even a webhook available for carts/update, so that before the customer has checked out there are responses sent that can be handled if need be.

 

CSLConsult
New Member
1 0 1

Hi

 

I am the developer of the app in question and Brainblend directed me here.

Our app is essentially a carrier service, meaning we offer a number of shipping methods during checkout using this: https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/carrierservice.

The data we receive does not include any discounts, but only the price of each product - as can be seen under "Example shipping rate request sent to a carrier service". Our service therefore calculates the total sum (and weight) of the order based solely on the price listed for each product. Based on this total, our service decides whether to offer free shipping based on criteria setup by the shop owner.

If the customer enters a discount code or the shop owner has a special sale, then our calculated total price is wrong and hence it wrongfully offers free shipping.

 

This is actually a well known issue and here are a couple of other posts about it - dating more than 4 years back.

 
If anything has changed or there is some sort of workaround, then I am very interested in hearing it. I cannot fathom why this is yet unsolved....!?
Gregarican
Shopify Partner
1030 86 276

@CSLConsult thanks for the clarification. Now I see what you are dealing with. That is really strange that the discount fields aren't passed along with the CarrierService responses. But according to the one link you provided (https://community.shopify.com/c/Payments-Shipping-Fulfillment/carrierService-API-Access-to-Coupon-Di...) it appears as if Shopify Plus plans allow access to the Discounts API. Although the Shopify reference page gives a 404 error.

If there were other API channels you accessed the Shopify data with then all of this information would be visible. Anything from the REST API to the GraphQL API to receiving webhooks. If you are limited to only utilizing the CarrierService API then this sounds like a dead end. We too faced a limitation that required an upgrade to the Shopify Plus plan. For our Shopify POS implementation, the app doesn't properly calculate Tennessee tiered sales taxes. And for it to work we would have to upgrade to the Plus plan in order to have access to an Avalara app plug-in. Just for properly collecting sales taxes. Just as the concept of seeing order discounts should be basic functionality without having to upgrade to Plus... 

Gregarican
Shopify Partner
1030 86 276

@_JB tagging you here so you perhaps to speak to this integrator's issue? Seems that the CarrierService API doesn't pass order discounts back in the response. Sounds like a longer-standing issue based on the threads the developer has listed...

_JB
Shopify Staff
Shopify Staff
836 100 219

Hey @Brainblend @CSLConsult @Gregarican,

Thanks for bringing this up, our product teams are aware of this limitation with CarrierService, and are working to solve it with changes that will be announced at a later date. Keep an eye on the changelog and API release notes for those details once they're available. 

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Brainblend
New Member
2 0 0

Thanks a lot you all! 

Looking forward for a solution. 

Best, Ida 

vellov
New Member
1 0 0

This question is up since 2013 in other forums, how hard is it to add one extra field with total order sum, or discount field for each item???

jonk8
Shopify Partner
1 0 0

Hey @_JB any update on this request?