I have a delivery guarantee app that adds a gurantee product to the merchant store whenever they install it. Then I have a Widget on cart page that allows buyers to add my product to the cart. Whenever the cart page is accessed my Widget runs the following request to get the product information:
For one store only I'm getting 404 on this request. I have replicated the same request in Postman and it works, then I realized it must have something to do with "Cookie" in the headers section of the request. When I send it on Postman I also get a 404. But only for this store and with this specific Cookie. I copied the Cookie sent from other store and used in the same request on Postman and it also works. So there is something in this Cookie of this specific store that is making the Shopify API return a 404, but I don't know what, or how this Cookie is even generated, since I'm not explicitly setting it on my end.
Any help is appreciated.
UPDATE: I'm currently located in Brazil and when I access the merchant store I get this issue, but if I change my location to the US it works. Does this make sense?
This issue might be related to the privacy and security settings of the specific store or the geographical location settings. The cookie that is causing the issue might belong to the user session, and if the session has expired or is not valid, it could lead to a 404 error.
The Storefront API uses a session-based authentication strategy. When you make a request to the Storefront API, the server uses the 'cookie' header from the request to identify the customer's session. If the session is not valid or has expired, you will receive a 404 error.
If you're seeing a difference in behavior depending on the geographical location, it could be due to Shopify's international domains feature, which allows merchants to assign a specific domain to a certain country or region. In your case, it seems that the specific store might have set a different domain for Brazil, and the product handle you're trying to access doesn't exist on that domain. When you change your location to the US, you're likely being redirected to the primary domain where the product handle exists, hence why you're not seeing the error.
To resolve this issue, you could:
1. Ask the store owner to check if they have different domains set up for different countries, and if so, ensure that the product handle you're trying to access is available on all domains. 2. Make sure the session is valid when making the request. If you're not handling the session on your end, it could be that the session is being handled by Shopify. In this case, you might want to reach out to Shopify support for further assistance. 3. Try making the request without the 'cookie' header to see if that resolves the issue. If it does, then the problem is likely with the session associated with that cookie.
Also, note that the Storefront API has certain limitations. For example, it doesn't allow fetching data that is not published to the online store sales channel. If you're trying to access a product that is not published to the online store, you might receive a 404 error. Make sure the product is published to the online store sales channel before making the request.