I was wondering if there was a good way to remove an item from the cart when the total of the cart drops under a specific amount after adding discount codes.
I found the property:
These work but they don't actually remove the item. In my case when I remove the discount code, it auto adds that item back in.
It's a complecated requirement, let me know if I understand your requirement correctly.
You have a threshold order amount which impacts when a copy or discount will be their in cart.
You want to check if amount after discount if less than the threshold a item will be removed.
Question is how you will decide which item to be removed?
And want that item back in cart if discount is removed.
Let me know if anything I missed.
Not quite. So I already have a way to identify which line item to remove (line item property).
What I want to know is how to remove an item from the cart without it being added back. Currently, if my cart amount falls under a certain total (after applying discount), the item gets removed. My issue is that when the discount gets removed by the user, that removed item gets added back in automatically.
Not sure why that is happening if the cart.line_items.delete_if removes the item.
Not sure about cart.line_items.delete_if working.
You can keep the variant id in cookie when your script updating the cart and add again to cart when discount code removed.
So this is inside a Shopify Script, not sure I have access to cookies.
What I want to know is how to remove a line item using Shopify Scripts.
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...By Arno Nov 27, 2023
You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...By Skye Nov 8, 2023