Open beamercola opened 4 years ago
I was making a PR, but I realized there's a "fundamental" problem for me in here. In the actions like updateItemQuantity
orremoveItemFromCart
- they expect a variantId
as the parameter, and it looks for a cart item with that variant with getLineItem
.
But in the case of using customAttributes
it's possible to have two separate variants in the cart. I believe this reverse lookup shouldn't be done, and suggest passing the lineItemId
which we have anyways.
I've done this in a branch on mine and it seems to be working well
Thoughts?
Thank you for this! I have done very little with custom attributes but I knew that my solution was probably lacking 😄 I think what you're proposing makes sense. Are you saying that we should change the existing API or add a new API called useUpdateItem
?
In my mind, it makes sense to keep the API the way it exists and then add another hook to help with this.
@thetrevorharmon Agreed, I'll send a PR as soon as i get around to cleaning it up.
updateQuantity is nice but I need to be able to update
customAttributes