-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add to Cart never works #2
Comments
So I figured out that the application needs to actually get a price of a product to create the Add to Cart, but there is no indication that a price needs to be in the JSON file for the product. So are the prices only getting fetched from the Commerce Layer endpoint? Not clear how this works. Also, it looks like the "sku" key in the products.json is what is used to fetch the data from CommerceLayer. If so, what is the purpose of the "variantCode" key? |
Hi @osseonews ,
Going back to your original question, you already added the client id and the endpoint in your environment variables. As said, the product sku has to be present as sku in your commerce layer organization and your organization need to be properly configured (did you add a price and a stock for that sku?) If this still doesn't work, open the developer tool from your browser and check if you have any console error and if you see any network request to commerce layer API endpoint. I hope that this can help you, and thanks for your feedback. We will update the demo store documentation to better clarify all these aspects. |
Hi @marcomontalbano Thanks for the comments. Yes, we realized that we need to have the SKU in the commerce layer organization and also that we need to update the countries.json file with the correct market id. We did both, but the problem is that whenever we update the products.json file with the correct SKU from our commerce layer organization, we get errors on the frontend. Specifically, one error is This happens because have changed the SKU in the products.json file to our sku, but for some reason the system is still looking for the old SKU 5PANECAP000000FFFFFFXXXX. We tried to remove the .next folder to clear the cache and rebuild, but it doesn't do anything. Basically, we cannot figure out how to actually use our own product.json data. We have tried repeatedly to update the products.json file per above with the correct SKU's, but we keeping errors for SKU's that only exist in your implementation of the products.json. Any ideas? Thanks. |
Hi, did you update the pages.json and taxons.json? In these file there are references to skus for our demo.
Let us know |
Thanks. Yeah, we didn't update those. Wasn't sure what they were for. We will update now and see if it fixes the error. |
BTW, fixing the pages.json and taxons.json file worked! But, we also needed to modify the slug in the products.json. Anyway, we can now get our products from commercelayer. Have a few more unrelated issues, i'll post. thanks. |
Thanks a lot for your feedback! We will improve the documentation with all these findings. |
@marcomontalbano below are some more issues I have found. I figured it might be easier to just list them all here instead of opening a new issue for each one:
That's it. hope it helps. |
Hi @osseonews, thank for sharing these. |
Hi @marcomontalbano Thanks. What does it mean, internal card? That means you are already working on fixing the cart bug? |
BTW, I think "Removing locale from URL for main locale " is a critical thing, though obviously not a bug. The issue is that this repo is a low-code way of building a CommerceLayer website. Most low-code website are built by small biz, who will not have websites in multiple countries and languages. So even though it's great to have a solution that can support growth via different languages down the road, if you need to, for immediate needs it's not a good solution. I would think you can set some sort of default value for the location in an ENV variable, and then the main routes in the store can drop the location in the URL, and then only the secondary locations will show up in the URL, if they are used. |
Yes exactly. We already having an internal discussion about that. Demo Store is embedding our Hosted Cart, that's why state is not shared at all. |
Just a quick update, I did some research on the SEO issue and I'm quite convinced that doing it the way you are doing it now, all variants have their own URL even if the canonical URL points to the master product, is not good for SEO. As SEO is critical for any website, I think this is the wrong route to go down. It's also very confusing for a user in terms of a UI, as you have multiple URL's with the same exact content. The correct way to do this is that variants of a product should never have their own URL. Only the master product page should have a URL/Slug. For products that don't have variants, then obviously it's not an issue. |
We built this demo store locally, with our unique client id and endpoint, and we were able to see all the pages, navigate etc. However, on the actual product page, the "Add to Cart" button is never functional. It is just greyed out and you can't click it. Is there some other setting required to activate the Cart? Thanks.
The text was updated successfully, but these errors were encountered: