Fetch from checkout extension to Shopify's product recommendation API blocked

kyle_truong
Shopify Partner
59 6 16

I'm trying to call Shopify's product recommendation API from the checkout extension but am getting cors errors. The script seems to be hosted on cdn.shopify.com, but despite enabling network_access in both the extension and partner dashboard this does not seem possible. I cannot call my own app proxy either.

How do you call the product recommendation API from the checkout extension? I also made a Github issue here:

 

https://github.com/Shopify/ui-extensions/issues/489

Replies 2 (2)

abhisheksingh75
Shopify Partner
10 0 2

hey...if you solved this issue...can you please help here!

Eltrino
Shopify Partner
14 0 10

If you are trying to access the Shopify Storefront API and your store is password-protected (such as a development store), you may encounter authentication issues.

 

To resolve this issue, you can add "credentials: 'include'" to your fetch call. This will include any credentials, such as cookies or authorization headers, in the request. With this, you will be able to authenticate the request and access the Storefront API even if the store is password-protected.

 

However, this does not solve the issue in the case of App Proxy. We faced the same issue, but we were able to figure out why we received a CORS error for the Storefront API.

 

I hope this helps.