Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Customer to fill out a form that generates a discount code to be applied when they go back to cart

Customer to fill out a form that generates a discount code to be applied when they go back to cart

archwaytech
Visitor
1 0 0

We have a client who wants to have customers fill out a form for a discount before checking out. I'm thinking we can accomplish this with a simple php script hosted on their site. We'll add a link on the checkout page to the php form. The customer fills out the form and submits it, some logic is processed behind the scenes to verify the customer qualifies for the discount, and a discount code is generated.

Here are my questions:

  1. Is it possible to add a cart ID to the link to the php form? Meaning, I'd like the customer to go to the form, fill it out, and be sent back to the shopping cart and have the discount code automatically applied to the existing cart. Is it even necessary to use a cart ID, or can we just use the cookies to revive the cart?
  2. Is it possible to automatically apply a generated discount code to the cart by adding the discount code in the URL being fetched to revive the cart? For example, the customer would be sent back to the cart using a URL like "mysite.shopify.com/cart.php?cartid=12165461321&discountcode=asdfq65wfa - and have the cart apply the discount code based on the URL?

I can do all the PHP coding myself. I just need to know how to pass the information back and forth to have the discount code applied automatically.

Replies 0 (0)