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.

How to remove line item custom attributes using GraphQL?

Solved

How to remove line item custom attributes using GraphQL?

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 Partner
39 3 24

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, Shopify Experts Since 2011 // Los Angeles, California // View Website Showreel
B2B Draft Order Invoices & Reminders Shopify App: Leverage Shopify draft orders for invoicing & send payment reminders. A must for any B2B business.
Wishlist & B2B Project Planner: A multi-wishlist solution geared towards b2b applications and planning multiple projects with many products involved.

View solution in original post

Replies 2 (2)

ConspireAgency
Shopify Partner
39 3 24

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, Shopify Experts Since 2011 // Los Angeles, California // View Website Showreel
B2B Draft Order Invoices & Reminders Shopify App: Leverage Shopify draft orders for invoicing & send payment reminders. A must for any B2B business.
Wishlist & B2B Project Planner: A multi-wishlist solution geared towards b2b applications and planning multiple projects with many products involved.
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!!