Deploy specific JS scripts for each user & custom discounts on the fly

Deploy specific JS scripts for each user & custom discounts on the fly

KryptonCoD
Visitor
1 0 0

Hello,

 

I'm trying to develop an app that allows the user to set up pop-ups to specific product pages. This pop-up will basically ask a price for the product and on click "submit" click it should redirect to the cart with this specific price.

 

If I understood correctly the API's documentation, I need to use:

  • ScriptTag API (to deploy the Javascript script that shows the popup in the user's store)
  • Webhooks API (to do something when the user clicks on the popup's button ?)
  • What should I use for on-the-go discounts (I don't want discount codes)?

Also, do I need to store and host a script for each user ?

It feels like my needs are too complicated for the Shopify environment. Am I getting something wrong?

Reply 1 (1)

Jason
Shopify Partner
11201 226 2310

You first need to understand how the cart/checkout works. Anything added to the cart is a variant. That variant has a defined price.

 

If you're looking to add a product at a custom price then either:

  1. the variant still must exist on the shop at that price
  2. there is a discount code (manual or automatic) that will be applied
  3. you're using Draft Order API to create a new checkout (risky, take into account API limits).
  4. you're using Shopify Scripts for Shopify Plus merchants, though don't see it being a good use case here.

Webhooks won't be suitable for tracking clicks either. That would be AJAX calls back to your app. How you secure that url from exploits is something you need to think about.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★