Order Custom Shipping Price

Solved
puda_cb
Tourist
7 0 0

Hi!

 

I'm trying to create an order via the API with custom product prices and custom shipping price. So far, I'm able to create the line items with custom prices, but no where in documentation does it say how to add custom shipping price.

 

I tried adding "line_items" item with the "price", "code", "title" fields, but that gives me 400 bad request.

 

Any help on this would be appreciated!

0 Likes
Joel-Reeds
Shopify Partner
164 9 53

This is an accepted solution.

Hey @puda_cb,

 

Check shipping_lines out.  This is where Shopify will store the shipping rate for orders processed via the checkout.

 

 

Regards,

Joel.

Co-Founder / CTO @ Intuitive Shipping Inc.
Intuitive Shipping | Smart Boxing | Automate Shipping Profiles
suzan_stha
New Member
6 0 0

@puda_cb @Joel-Reeds 
How did you managed to solve it ?

 

I tried by sending the following data, but the shipping cost was not added.

 

{
  "order": {
    "line_items": [
      {
        "variant_id": 31253838430251,
        "quantity": 1
      }
    ]
  },
  "shipping_lines": [
  {
    "code": "INT.TP",
    "price": "4.00",
    "price_set": {
      "shop_money": {
        "amount": "4.00",
        "currency_code": "USD"
      }
  }
  }
  ]
}

Can you please provide us a sample code or data. Thanks.

0 Likes
BalajiAdober
New Member
1 0 0

Please help in this. @suzan_stha @puda_cb @Joel-Reeds 

Are all of the fields here mandatory? Please suggest what worked for you. I am just trying to add a Custom Shipping Method with a custom price. Their Draft order API was simple to handle this, but this has a few complications

  • code: A reference to the shipping method.
  • discounted_price: The price of the shipping method after line-level discounts have been applied. Doesn't reflect cart-level or order-level discounts.
  • discounted_price_set: The price of the shipping method in both shop and presentment currencies after line-level discounts have been applied.
  • price: The price of this shipping method in the shop currency. Can't be negative.
  • price_set: The price of the shipping method in shop and presentment currencies.
  • source: The source of the shipping method.
  • title: The title of the shipping method.
  • tax_lines: A list of tax line objects, each of which details a tax applicable to this shipping line.
  • carrier_identifier: A reference to the carrier service that provided the rate. Present when the rate was computed by a third-party carrier service.
  • requested_fulfillment_service_id: A reference to the fulfillment service that is being requested for the shipping method. Present if the shipping method requires processing by a third party fulfillment service; null otherwise.


    Thanks
0 Likes
suzan_stha
New Member
6 0 0

I added these there simple line and it worked,

'shipping_lines' =>
array(
array(
"custom" => true,
"price" => $orders->shipping_cost,
"title" => "Standard Shipping",
)
),

 along with other order data. But this data should be sent while creating the order. Update may not work. 

0 Likes