Out now! Check out the Poll results: Do you have a Shopify store?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Store Shipping rules not being added to draft order correctly

Store Shipping rules not being added to draft order correctly

Thee-dust
Shopify Partner
1 0 0

using a php backend we are using 2023-10 admin api to create a draft order. the issue I'm having is the shipping prices set on my store is not being set properly to the draft order. in the payload of making a draft order we have a key of shipping_line that has 3 key value pairs in it. handle => 'Standard', price => 0.0, title => 'Standard'. on 10/24 the shipping price would be updated to be the correct shipping price(ex: 4.90) and reflect looking at the shopify draft order in admin. starting 10/27 the shipping price is being set to 0.00 now and not allowing the draft order to be completed because shopify says the total has changed. looking at the order the shipping line is 0.00 but the total has the correct shipping price included. ex subtotal being 50.00, shipping says 0, total says 54.90. 

i have tried removing shipping_line from payload and shipping does not get added to draft order as well

Reply 1 (1)

Liam
Community Manager
3108 344 888

Hi Thee-Dust,

 

The issue you're experiencing seems to be related to how Shopify is processing the shipping in your payload.

 

The shipping_line field in the payload is intended to specify custom shipping methods for a draft order. When creating a draft order with a shipping line, the price field is used to override Shopify's calculated shipping cost. Since you're setting the price field to 0.0, Shopify is setting the shipping price for the draft order to $0.00.

 

If you want to use Shopify's default shipping prices, you should not include the shipping_line field with a price of 0.0 in your payload. Instead, you should only include the shipping_line field with a handle that matches one of your store's shipping methods. Shopify will then calculate the shipping cost based on the customer's address and the shipping method.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog