Hey Guys,
The issue I’m facing is, that I want to create a buy box/feature-product section on the homepage in shopify hydrogen. The flow that I noticed in hydrogen is that it gets value (product handle) from URL prams and the same for variants as well, like http://localhost:3000/products/tape?Color=Black&Size=S.
However, on the homepage, we do not have this URL, so we cannot fetch all product data using ID. So, I ran a custom GraphQL storefront API in JS in a component and fetched data for that product (which I believe is not the correct approach in the hydrogen framework). I can render the product data now, but I am facing an issue with adding the product to the cart.
If I use inbuilt AddtoCart button/component of hydrogen , but it is not working as it works with cart context and other hydrogen setups. My component is custom-made.
So, how do I create this component? I’m also attaching the product component file, in case you want to look.