How do I create automatic discount codes from a customer's order number?

How do I create automatic discount codes from a customer's order number?

hfreedm
Visitor
1 0 0

Hello,

 

I work for an E-commerce business that makes embroidered goods. The customer has to upload their design, and then we digitize them and have it embroidered on their apparel.

 

We charge a Set Up Fee to cover the cost of digitization, and if you are reusing the same design for a different order, you are refunded your Set Up Fee. However, we have no automatic process or way for our website to identify they are reusing the same design even though they are using our reorder button, so customers are still charged their Set Up Fee when ordering, and then we go in and refund them. The issues are with this is that it leaves room for human error in regards to forgetting to refund the customer their Set Up Fee, and customers write in about their Set Up Fee being included in their order.

 

My idea was to create automatic discounts that use the customer's order numbers, so that way they will receive their discount on their Set Up Fee and we will be able to see what past order they are wanting to reuse the design from.

 

Please let me know if you guys have any recommendations on how to do this, or different methods to achieve the same goals!

Replies 4 (4)

tobebuilds
Shopify Partner
556 42 151

Hi Hfreedm, please answer the following questions:

 

  • How are you charging this set up fee? Are you using an app, etc.?
  • How do customers upload their designs to your store?
  • How would you detect the customer is using the same design? Are you using cart attributes? Line item properties? Something else?

 

Based on the information available, I'm making the following assumptions:

  • You are using an app to allow customers to upload their designs as images (or some other file)
  • Each file has a unique ID (or hash). If you select the same design you did in a previous order, the ID will be the same.
  • The ID is stored as a cart attribute.

If so, then you'd need to do the following:

  • Create a string array metafield on customer accounts
  • When an order is placed, store the design's ID in that array metafield
  • Create a Shopify Functions automatic discount that checks the design ID cart attribute against the value of that metafield, and then if the design has been used before, apply a discount.  (Whether to make this a product or order discount completely depends on how you have implemented the setup fee)

 

Best,

Tobe

Founder, Regios Discounts app (4.8 stars, 83 reviews, Built for Shopify)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer
- Often imitated, never duplicated

richardcobain
Pathfinder
120 4 14

You could automate this process by using a Shopify app like ReCharge or Bold Custom Pricing to recognize returning customers and apply a discount for repeat designs. Another option is to create a discount code system where customers enter their previous order number at checkout to waive the Setup Fee.

 

For a more seamless experience, a custom app or script using Shopify Functions could check if a customer has a past order with the same uploaded design and automatically remove the fee. If you use Shopify Plus, you could create a checkout script to conditionally apply the discount based on order history.

Promer-Alena
Shopify Partner
250 25 91

Hi @hfreedm 

 

Here are a few possible solutions:

 

  1. Use Shopify Scripts (if on Shopify Plus) – You can create a script that checks past orders and automatically applies a discount if a customer is reordering the same design.
  2. Shopify Flow + Tags (for Advanced Plan or Plus) – Use Shopify Flow to tag customers who have paid the setup fee. Then, create an automatic discount that applies when they reorder.
  3. Discount code via post-purchase email – Instead of manual refunds, send customers a unique discount code tied to their past order, which they can apply when reordering. Apps like Bulk Discount Code Generator can help automate this.
  4. Custom app or Shopify API – If you need full automation, a custom app could verify past order numbers and apply a discount automatically at checkout.
  5. Customer accounts + loyalty program – Encouraging customer accounts instead of guest checkouts can help track orders and automatically provide discounts for repeat designs.

If you’re not on Shopify Plus, Shopify Flow + tagging or discount codes via email would be the easiest workaround

Abel_Lesle
Shopify Partner
150 1 12

Hi @hfreedm ,

 

I'm assuming the following

  1. You're using an app to add the setup fee product to the user's cart
  2. Designs are uploaded to the store through the use of an app 

 

Current scenario 

  1. Setup fee is charged on every order regardless of whether the customer is reusing the design / using a new design
  2. Refund is done manually to the customer if they are re-using / reordered using an existing design
  3. Refund incurs transaction fees 

Proposed solution

  1. Store a list of previously uploaded designs on a customer metaobject / metafield 
  2. When customer is on the store - check if the design added matches any of the existing ones
  3. If yes - do not add the setup fee product to cart. If no - then add the setup fee product to cart.

This can be done through a custom app / through automation tools like n8n / flows / mechanic. 

 

If you need help with a solution like this, feel free to reach out on DM for further information and I'd be happy to assist. 


Best

Founder - Dollarlabs : Ultimate Discounts (5★)
- If you can think of a discount, you can build it
- Built for Plus merchants using Rust