Hey everyone!
I have a situation where a Shopify Plus client of mine wants to offer discounts to users depending on that customer’s tags.
This is the user journey thus-far:
-
Customer lands on “customer lookup page”, enters their email address, and then clicks “continue”
-
We redirect the user to blah.myshopify.com/cart/{product-variant-id}:1?checkout[email]={email-address}
-
We land in the checkout flow, on the information step with Email address pre-filled
To accomplish the discount portion of this I’ve created an Order Discount function inside an app. The RunInput of this function pulls the buyerIdentity off of the cart, inside there we grab the customer and their tags. I have some logic that determines whether or not a discount applies for that customer.
I then return an object from the run function that contains a discountApplicationStrategy AND an array of discounts.
I can tell that the function is running inside my app’s extensions page. I see that I receive the correct customer in the RunInput, my logic determines the discount to return, and the discount that I expect is returned from the run function.
The issue here is that when users are redirected into a cart, no discount is shown UNTIL they hit the shipping step, in the shipping step I finally see the discount from my Order Discounts function run. Client worry here is that conversion rate is going to tank unless that discount is shown on the first step of checkout, Information.
Is there any way to specify when the discount is applied through the function run? Or am I going at this the wrong way?
I’m assuming I can’t run any js within the checkout flow or I would just ping an endpoint exposed by my app to run through my discounting logic and then just tweak (fake) the discount in the UI depending on the result.
Any help in making sure the discount applies on the very first step of checkout would be greatly appreciated, thank you!
EDIT: if I refresh on the Information step, the discount applies which leads me to believe that it isn’t gated behind the contact information being filled out.