Development discussions around Shopify APIs
I have a js script that updates skus on an outside affiliate tracking platform.
I'm looking to find an easy way for my customer to execute this script without having to get an outside server.
I can run the script in chrome devtools only when logged into the admin, and on the x.myshopify.com page. This is a CORS limitation.
Since the script has the api password, it can not run inside a page in the store.
I've looked at using custom apps, but those also require an outside server.
So far, the only solution I've been able to come up with, is loading the script into a bookmarklet that the customer can click when logged into the admin.
There has to be something more elegant, no?
You can include the script conditionally in liquid after checking if there is a customer and that customer is the one you want by checking id.
I tried this, but the store runs on a top level domain, not x.myshopify.com so it gets the same cors error. Even when loading in the store.
How about converting the script into a data url source instead of referring to actual source url? Like this:
<script src="data:text/javascript;UTF-8,window.alert('hello')"></script>
No luck. It's still having to run on a mystore.com instead of on mystore.myshopify.com so cors is still an issue.
The admin panel always loads on mystore.myshopify.com. If I could run the code somehow in the admin section, it would work.
I don't think there is any way to control resources that go into the admin panel
User | RANK |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
As a business owner, have you ever wondered when your customer's first impression of yo...
By Skye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023