Add a shipping method with the Order API

Can you add a shipping method with the REST Order API?

Example:

  1. An order comes in without a shipping method
  2. I want to add a shipping method and update the order

Here’s an example I tried (using the shopify_app gem):

order = ShopifyAPI::Order.find(2264716673078)
order.shipping_lines = [
  {
    custom: true,
    price: "0.00",
    title: "Free shipping"
  }
]
puts order.shipping_lines # This shows that the order object is updated correctly

order.save # Saves successfully

puts order.shipping_lines # After saving the order, the shipping_lines field is back to empty []

Any idea how to add a shipping method to an existing order with the API?

Hey @JoesIdeas ,

It’s not currently possible to add or modify an existing order’s shipping_lines, but you may be able to use our new order editing API to achieve a similar result. This API allows you to add or modify the line_items on an order, so this could allow you to add a custom line_item to charge for shipping. You’ll need to read through the docs to make sure this works for your use case, and don’t hesitate to reach back out if there are any questions.

Yes we can edit the order with graphQL with order lineitems but I am looking more up from this like remove shipping line items and edit shipping line items and discount assign to order if we want. Please help us. Is this possible graphQL API