[Feature request] Allow customAttributes input (line item properties) for orderEdit API

Currently it is not possible to specify customAttributes (line item properties) for a line item, when we try to add variant / custom item to an existing order (orderEdit API : orderEditAddVariant - GraphQL Admin and orderEditAddVariant - GraphQL Admin).

I would like to request the ability to specify customAttributes (line item properties) when adding variant or custom item during order edit.

Hope this request can be considered, thank you

2 Likes

Hey again @soulchild :waving_hand: - hope all’s well! Thanks for flagging this. This is a pretty desired feature that we have on our radar (there’s a pretty interesting discussion here from a while back in our old forums if you’d like to take a look at it).

In that thread one of the recommendations is to leverage metafields (more info here). There isn’t a specific line item metafield type, but you could use Order metafields to store the data needed (using the orderUpdate mutation).

Not the most ideal workaround for sure - but metafields are pretty robust and are the recommended method at the moment.

I’ll link to your thread in my notes here for the feature request record we have on our end though, just so we track it on our side - hope this helps!

Hi Alan,

Thank you for the reply. Unfortunately the workaround of using Order metafields does not work, as we can’t show order metafields on order confirmation / update email template (https://help.shopify.com/en/manual/fulfillment/setup/notifications/email-variables#order-fulfillment), as we have to convery the information of the line items to customers.

Thank you for linking the feature request!

1 Like

Hi Alan,

As Soul Child pointed out, this isn’t a workaround to the issue. Shopify could easily let you add a line item property, just like it lets users delete line item properties. If Metafields could be used for the same purposes then Line Item Properties would be depreciated. I’ve been asking for this feature for 5 years now. I have never gotten a response. It’s essential to editing orders for so many stores.

Hey @Alan_G - On a slightly related, it would be great to see the OrderLineItemDeleteCustomAttributeMutation be exposed to the Public Admin API - Last time I checked I saw it’s only available via the Internal API (Someone please correct me if I am wrong).

I think this could potentially also solve the other people’s use cases as an interim solution, since it’s already available within the Admin and therefore shouldn’t have any downstream effects that aren’t already triggerable within the Admin.

For some context, we have a setup where we use signed line item attributes to manipulate prices via functions, these attributes are then unpacked into an order level Metafield via a custom app. We tap into these attributes within email templates, functions, etc. but post-order, our point of reference is now that order level Metafield - Which we can make edits to.

It would be great if we can clear our these attributes via the Admin API, once we drop the data into an Order Metafield, for a cleaner Admin experience (These attributes are not very pretty).

Thanks for the additional context there folks. I definitely get how the metafield workaround doesn’t meet your needs due to the email template limitations. I believe this has been a fairly popular request, so I hope there is some time to look into this in the near future and I’m happy to log another request for this on our end to see if that helps gain some traction.

@kurt That’s an interesting point about OrderLineItemDeleteCustomAttributeMutation. Just out of curiosity, could you share where you saw this mutation? Just wondering if it’s being exposed in requests from the Admin that can pop up in the network logs in Chrome Dev tools for example.

I can’t confirm for sure if we’d expose that mutation publicly, but happy to look into this to see if I can share more info and potentially put in another feature request for this too.

Hey @Alan_G - it sure is - Here’s the request in full, pulled from the dev tools:

POST https://admin.shopify.com/api/shopify/xxxx?operation=OrderLineItemDeleteCustomAttributeMutation&type=mutation

{
    "operationName": "OrderLineItemDeleteCustomAttributeMutation",
    "variables": {
        "id": "gid://shopify/LineItem/xxxx",
        "orderId": "gid://shopify/Order/xxxx",
        "attributeKey": "YOUR_ATTR_KEY"
    },
    "extensions": {
        "client_context": {
            "page_view_token": "xxxx",
            "client_route_handle": "order:show",
            "client_pathname": "/store/xxxx/orders/xxxx",
            "client_normalized_pathname": "/store/:storeHandle/orders/:orderId",
            "shopify_session_token": "xxxx",
            "shopify_multitrack_token": "xxxx"
        }
    },
    "query": "mutation OrderLineItemDeleteCustomAttributeMutation($id: ID!, $orderId: ID!, $attributeKey: String!) {\n  orderLineItemDeleteCustomAttribute(\n    id: $id\n    orderId: $orderId\n    attributeKey: $attributeKey\n  ) {\n    lineItem {\n      id\n      customAttributesV2 {\n        type\n        key\n        value\n        __typename\n      }\n      __typename\n    }\n    userErrors {\n      message\n      __typename\n    }\n    __typename\n  }\n}\n"
}

Totally understand if it’s not possible, and appreciate you looking into it!

Thanks @kurt - still digging into this, but I’ll loop back with you once I have more info to share :slight_smile:

Hey @kurt - just following up with you here as I was able to get a definitive answer for you. Right now, there’s not a way to modify line item attributes in the cart via the order editing API and we don’t currently have a plan to allow for this via the public API.

That said, I’m definitely happy to put through another feature request for you on my end (it can sometimes help if we have lots of folks requesting a feature when it comes to considering adding new capabilities).

If you’d like to share your use case with me here, I can add that to the feature request report on my end and make sure our product teams take a look at it. I can’t guarantee that it will become something we enable, but we will have product take a look at the request for sure.

Hope to hear from you soon!

@Alan_G thanks for looking into this. Please note that this feature has been requested by thousands of merchants and developers for many years now.

Our team is serving 10k+ merchants and we get multiple support tickets every day asking for how to edit the line item properties of an existing order. (Always same answer Shopify does not allow it :frowning: )

An order editing API for line item properties is desperately needed.

Hey @michael :waving_hand: Thanks for sharing the context here. I can definitely understand the frustration there when you have to keep letting folks know that it’s not currently possible.

I’ll include your feedback in my feature request report. I can’t guarantee anything on my end here, but sometimes real-world numbers can help move the needle on prioritization.

1 Like