Develop an App that insert and recall a javascript file when needed

Highlighted
Tourist
13 0 1

Hi,

I want to develop an App for Shopify that to the installation insert in product page a javascript code.

This javascript cod that will be executed in the product page then when the document is loaded (if the product displayed has vendor like MYAPP NAME this could execute call to the main server of the app.

Fisrt call
The javascript code take the product sku and send it to my server.
If this call is positive to same parameter inject a input box where the client can fill it.

Second Call
If the client write in the input box the javascript code take the value of the input box and sku vale of the product and send it to the main server App
The response of this call will be an encoded image (base64_encoded image) which will be replaced to the main image of the product.

Obviously the text entered in the input box must be added to the notes or to a custom field until checkout and then it will be saved in the order.

Is this possible?

Thanks in advace.

Best Regards.

0 Likes
Highlighted
Shopify Expert
9930 105 1766

There's no question in this post. Was there something you wanted some advice on?

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted
Tourist
13 0 1

Hi Jason,

 

I want to know if my app can be build with this features

 

Thanks in advace.

Best.

0 Likes
Highlighted

I think this is possible. The Shopify API has a ScriptTag section that explains how to run js on all pages. This would probably be where you insert a small js library that checks the URL (Shopify also has a Shopify object in js with some data, but doesn't look relevant to the product) or something to see which product it is. Then you could do any processing/injection you want.

 

While I think it's possible, I don't want to downplay the amount of work required. Maybe getting it to work for a single theme would be easy, but multiple themes could be very difficult.

 

If you just want to do this with a single store, you could edit the theme and manually include the JS in the product page. I don't know liquid that well, but I'm sure there are ways to inject the product ID, sku, or other data into a json field or variable.

Want to increase conversions or get more social media attention? Try Brisa Video Creator to quickly and easily create videos that engage your viewers!
0 Likes