Generating and sending referral discount codes to customers, as described in your scenario, typically involves the following process:


Customer Qualification: 

Customers are qualified for the referral program based on specific criteria you've set, such as rating a product with 4-5 stars.


Email Trigger: 

When a customer qualifies for the referral program, the system triggers an automated email notification. This email is sent to the customer's registered email address.


Email Content: 

The email usually includes information about the referral program, details on how it works, and the referral discount code. 


Unique Discount Codes: 

Each customer receives a unique referral discount code. These codes are generated by the system and are typically one-time use codes to prevent abuse.


Email Delivery: 

The email is sent to the customer's registered email address, and they can access it in their email inbox.


Testing the Process: 

To test this process, you can follow these steps:


Go to your store's website.

Rate any product with a 4-5 star rating.

Wait for a moment, as there may be a delay in processing the qualification.

Check your email inbox for the referral program notification email.


This allows you to ensure that customers receive their referral rewards as intended when they qualify for the program.