Open ontimond opened 5 days ago
@ontimond Thanks for the report.
I'm not able to reproduce this issue. I can clear cart lien attributes using a call like:
applyCartLineChange([
{
id: 'line-item-id',
type: 'updateCartLine',
attributes: [], // Expected to remove all attributes
},
]);
And I can also see add and then immediate clear them as shown in your example code above.
Can you provide more details about your use case that might help us investigate this further?
Description
The
useApplyCartLinesChange
function allows updating a line item in the Shopify checkout. While it supports adding and updating custom attributes through theattributes
array, it does not currently provide a way to remove an attribute that has already been added to the line item. This limitation prevents clearing or resetting custom attributes, which is necessary in certain scenarios.Steps to Reproduce
useApplyCartLinesChange
hook to add custom attributes to a cart line item.attributes
array without the attribute you wish to remove.Expected Behavior
When an updated
attributes
array is passed to theuseApplyCartLinesChange
function, any attributes missing from the array should be removed from the line item in the checkout.Actual Behavior
Attributes that are not included in the updated
attributes
array remain in the line item, making it impossible to delete attributes.Example Code
Here is an example of the issue: