How to remove line item custom attributes using GraphQL?

Solved
pedropadron
Shopify Partner
2 0 0

Hi

I have custom attributes added to the line items on my orders, like this

 

pedpad_0-1636215698407.png

for a line item the custom attributes: _handles, _products, _sku and _quantityPerProduct are added (hidden using '_') to do some validations on the frontend

but after the order is paid, I want to delete/modify the attribute: _handle

  • is there any way to do this using Graphql ? 

So far I can't find any mutation that allows me to modify a custom attribute on a line item in an order

Thanks in advance

 

Accepted Solution (1)
ConspireAgency
Shopify Expert
34 3 23

This is an accepted solution.

It doesn't look like you can edit the existing line item, but it does look like you could potentially add + remove (essentially replace) it to achieve the same thing.  I haven't tested it, but looks like in the admin removal is handled by setting quantity to 0.

Conspire Agency //
Los Angeles, California //
https://conspireagency.com
View my showreel: https://www.youtube.com/watch?v=E9upo48FQUg

View solution in original post

Replies 2 (2)
ConspireAgency
Shopify Expert
34 3 23

This is an accepted solution.

It doesn't look like you can edit the existing line item, but it does look like you could potentially add + remove (essentially replace) it to achieve the same thing.  I haven't tested it, but looks like in the admin removal is handled by setting quantity to 0.

Conspire Agency //
Los Angeles, California //
https://conspireagency.com
View my showreel: https://www.youtube.com/watch?v=E9upo48FQUg
pedropadron
Shopify Partner
2 0 0

yes,  I tried that and works but when you look the order details you can see the remove/add steps on the order history, that's why I wondered if there was a direct way to do it

But as you said, I also think this is the only way.

Thanks!!