Greetings y'all,
So I'm working on this nextjs project (but the problem is react.js based really) and I came across a problem, that when I add an item (with a certain attribute/variant) to the cart, the same product that exists in the cart, changes its attribute to the one I'm selecting. which is not the intended behavior. And it's confusing the heck out of me.
the files that concern this problem (as far as I can gather) are :
MiniCart.jsx (the file responsible to show the cart when clicking on the shopping bag icon)
AppContext.jsx (context file, where all of the logic of the cart reducer lies)
ProductIntro.jsx (the page section where you can select the variant and click "add to cart")
code repo: https://github.com/mhdalihoria/sinbad-v2
The endpoint that has a product with a variant: /products/8847
(Note: the page is in arabic mostly, but I'll translate the parts where the problem is at)