Any help for creating a product using jquery post from front end on button click

param_sheoran
Shopify Partner
4 0 0

Hi Everyone,

I recently worked on a store where a requirement is generated to create a new products from front of the website based on user choices and options. 

I was planning to hit Jquery.post on button click to create a product in backend. Is any help or example of something similar ? looking forward for a decent help.

thanks a lot in advance.

Reply 1 (1)

_JB
Shopify Staff
836 100 222

Hey @param_sheoran,

Don't use jQuery on the frontend, as this will require exposing your API key and secret on the frontend as well.

I recommend using an app proxy, which allows you to send requests from the frontend of a Shopify store to a remote server. It includes a verification mechanism as well, so you can be sure the request originated from the store. With an app proxy you can create an app that receives requests from the storefront app proxy. Your app can then use the data from that request to make an API call to Shopify. Making the call from your app server instead of jQuery ensures your API credentials remain secured.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog