Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Changing order's shipping lines via API

Changing order's shipping lines via API

awl19
New Member
5 0 0

Hi there,

I've got a problem I need assistance with. Our Shopify store has a feature to "ship at a later date" for orders and the fulfillment company we're using, because of the system they have in place, requires manual intervention on the fulfillment's end to stop/hold the order before getting fulfilled. As you can imagine this is not at all reliable. When the store scales up in sales volume we (those handling the orders at the store) cannot be expected to send emails for every relevant order and the fulfillment company cannot be expected to read every one of those emails and take the appropriate action on each of the orders on their end.

Pretty much anything we do on our end (relevant to this issue) - cancelling an order, closing an order, etc. is not registered on their end.

They told us that pretty much the only thing we could do is change the "shipping option" (shipping method, shipping lines, whatever vernacular you want to use) to an invalid one on their system. They said this would automatically stop the process on their end without us having to alert them and them having to manually stop it. And then when we were ready to ship we could just change the shipping option again back to the one originally selected by the customer.

We NEED this ability. Workarounds won't work.

If this is something we could in GraphQL, please let me know. 

Is this something that could be enabled or made possible by having a Shopify Plus account type for our store?

 

Thank you for your time.

Replies 6 (6)

Not applicable

Hello @awl19 

You could update shipping_lines for an Order using REST API: https://shopify.dev/docs/admin-api/rest/reference/orders/order?api[version]=2020-04

I need to understand the integration between your Shopify store and the fulfillment company better, but it sounds like they already receive your orders from Shopify after it's been paid. In that case you could use Script API if you're already on Shopify Plus or have an app that allows you to put a "Stop" or "Hold" by updating the Shopify Order's shipping lines as stated by the fulfillment company.

If you could send us an email at hello@achieveapplabs.com we can further discuss a solution.

Regards,

Sam - Owner

awl19
New Member
5 0 0

Thanks for your reply, Sam.

So, I've looked at the docs for this particular ability I haven't seen it.

What I've seen:

You can cancel orders, close orders, open orders

You can add/edit/delete order note properties

You cannot edit/delete order line item properties

 

Let's take an example order with shipping lines like this:

{
    "order": {
        "shipping_lines": [
            {
                "id": 2824129971363,
                "title": "UPS® Ground",
                "price": "11.13",
                "code": "03",
                "source": "ups_shipping"
            }
        ]
    }
}

 

And I tried changing it by calling an order update with the below data.

Attempt #1

{
    "order": {
        "shipping_lines": [
            {
                "id": 4328963482945,
                "title": "Standard Shipping (5-7 days)",
                "price": "0.00",
                "code": "Standard Shipping (5-7 days)",
                "source": "shopify",
            }
        ]
    }
}

 

Attempt #2

{
    "order": {
        "shipping_lines": [
            {
                "id": 4328963482945
            }
        ]
    }
}

 

Attempt #3

{
    "order": {
        "shipping_lines": [
            0: {
                "id": 4328963482945,
            }
        ]
    }
}

 

None of the attempts managed to change the shipping lines.

Any suggestions on edits that could be made to the code to accomplish this?

Not applicable

Perhaps Storefront API is better for this case since you can modify the record before it's "saved" or at least before a webhook would receive it. 

 

https://shopify.dev/docs/storefront-api/reference/mutation/checkoutlineitemsreplace?api[version]=202...

 

 

awl19
New Member
5 0 0

Thanks for that information.

That is useful, but seems to accomplish only half of what we want if you're only able to change the shipping lines once. We need to be able to change it once initially to a "fake" shipping line (using the Storefront API would be fine) and then change it again to a "real" shipping line after we've determined the order is ready to go out to fulfillment.

Do you think that's possible?

HunkyBill
Shopify Partner
4853 60 568

I have built many connectors between fulfillment companies and Shopify. The pattern has no problems scaling, and it is very flexible. You can try this yourself.

- orders get sent to the connector App that sits between Shopify and Fulfillment company. Middleware? Whatever you want to call it.

- items are scanned for fulfillment service. Can be many things. Thing of it like this: [fulfill_now, fulfill_later, fulfill_special, shopify, fuzzy_mugwump]

- connector then formats the data and sends it off for fulfillment.

So any SKU with service fulfill_now just goes now, for fulfillment. A SKU marked as fulfill_later, would be fulfilled later, by a Shopify Admin, when appropriate. Click a link in other words.

So the point is this. You set a SKU with a fulfillment service. The middleware decides what SKUs go where... and you can customize this a ton.

It is not hard to do either. You can jazz this up with lots of nice extras. Think of things like pre-release, manual release, etc.

 

Making fake products, relying on email, and other tomfoolery seems so flaky. No wonder you are frustrated. Stone Age computering! That being said, even Amazon is so lame in cases, email actually is used as part of the fulfillment process, so there is no point in belabouring the point.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Not applicable

You need to work with Draft Orders API then @awl19