Send html inputs to Shopify app with app proxies

Highlighted
Excursionist
18 1 0

Hello everyone,

 

I've created a custom liquid page in the Templates folder in my development store and I successfully attached it with the app and I can get the information I need depending on the access scopes.

I'm stuck now with sending the inputs' values from the new liquid page to the backend (Express.js) using app proxies.

Is this possible?

I followed this documentation but I still don't know how to implement it in my code.

The code I used is available in this documentation

0 Likes
Excursionist
18 1 0

Anyone?

0 Likes
Shopify Expert
3954 12 299

I'm stuck now with sending the inputs' values from the new liquid page to the backend (Express.js) using app proxies.

What does that mean? What are you stuck trying to do? Get what values? More details would be helpful. As an example of what I do for a pattern, I have a template in the shop that the merchant can edit. That same template is in my DB. When the Proxy gets a hit, typically the App is sent some data. An ID, whatever. Since I have this template, I fill in the Liquid that my App is responsible for. I used the ID to look something up, whatever. Now my template is a giant string of Liquid, with some Liquid tags filled in by me, and other I leave for Shopify. So I set the file type to be application/liquid and I send the string out the port back to Shopify. Shopify now renders the rest of the Liquid from the template, and WOW... what a cool thing. Right? 

 

So what's your problem? Try and explain it in some bullet points if you can. Simple is good.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Excursionist
18 1 0

Hi @HunkyBill, thank you for your reply.

Sure, I'll keep it simple, here are the things that I've done before:

  • I installed the new app in my development store
  • I created a new liquid page in the Templates folder (Online store > Themes > Actions > Edit code)
  • I used the code from the documentation that I've mentioned before (Express.js)
  • I copied the API key, and the Secret key to the .env file
  • I can pass the data that I want from the backend to the app (Using the rest admin API)
    • Example: 
      const shopRequestUrl = 'https://' + shop + '/admin/api/2019-04/price_rules.json';

Now I need to send the input's value (which is a discount code input) from that liquid page to the app so I can compare it with all the discount codes available in the store, because shopify doesn't allow calling priceRules from javascript due to security purposes.

 

Is this possible or there is another way?

0 Likes
Shopify Expert
3954 12 299

Again, your terminology is confusing, but let's try anyway.

 

What do you mean You can pass data from the backend to the App? Are you just saying your App works and you get the data you want making an API call? 

 

What is this mystical input specifically that you mention? Some form field a customer fills in? If so, you need to use an App Proxy callback to send the form submit value to your App. The whole point of the App Proxy pattern is to allow calls from the front-end SHOP to the backend APP. 

 

Make sense now?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes