Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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

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

kyle_truong
Shopify Partner
60 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
15 0 14

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.