Closed ncla closed 1 year ago
Why would you need the plugin to follow a redirect? Shopify sets the domain you use for the requests, and the plugin should follow this.
This is a back-end error and I need to import products. I had changed my Shopify store URL from xxx.myshopify.com to shopify.mycustomdomain.com, as such I updated SHOPIFY_APP_URL env variable to shopify.mycustomdomain.com. When using Storefront API, I want the checkout URL to be shopify.mycustomdomain.com, not xxx.myshopify.com - this works fine and users get redirected to shopify.mycustomdomain.com. Nice. But product import in back end is failing because it is now doing API requests presumably to shopify.mycustomdomain.com, which is presumably redirecting to xxx.myshopify.com for some reason. The domain used from SHOPIFY_APP_URL is used for both Storefront API and for admin back-end stuff.
For now a workaround would be to edit client.js and hardcode/change the domain property to the neat custom domain. And leave SHOPIFY_APP_URL to xxx.myshopify.com.
A proper fix in the package would be better though.
Hey @ncla,
Think I get that you want to set a custom domain on the front-end. The admin backend should always be able to use the .myshopify, but you want the front to be .mycustomdomain?
You can happily edit the client.js
as these are starter points that should be edited as you need.
Yes, that is what I did.
Related: https://github.com/phpclassic/php-shopify/pull/238 https://github.com/phpclassic/php-shopify/issues/206
Solution can be anything from setting CURL to follow redirects, separate config option for domain for back-end requests, allow override php-shopify config entirely through config.