-
In my product card component, I want to be able to access the cart and determine if the product is already in cart. if it is I want to disable the "add to cart" button as you can only add the product once. I'm using shopify hydrogen with remix, is there any way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can store a list of |
Beta Was this translation helpful? Give feedback.
I ended up using this approach but changing the way I fetch the cart so leaving this here for whoever needs it.
Why would I need it?
Steps
loadDeferredData
toloadCriticalData
.cart.get
and return it, that way you will always have access to the data without the need to await the promise.It should look like this: