Development discussions around Shopify APIs
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.
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.
@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...
@_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...
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
Thanks a lot you all!
Looking forward for a solution.
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???
Hey @_JB any update on this request?
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...By Jacqui Mar 10, 2023
Upskill and stand out with the new Shopify Foundations Certification programBy SarahF_Shopify Mar 6, 2023
One of the key components to running a successful online business is having clear and co...By Ollie Mar 6, 2023