Gift Cards
Navigate to yStore → Marketing → Gift Cards.
yStore has a complete gift card system that handles the full lifecycle: create gift card products in the catalog, sell them at checkout, auto-generate PDF vouchers, deliver codes by email, and let customers redeem balances at checkout. All code generation, balance tracking, and PDF creation happens automatically.
Gift card functionality requires the yStore Enterprise edition.
Overview
The three tabs
- Codes
- Cards (Designs)
- Accounts
Lists all generated gift card codes across all purchases.
| Column | Description |
|---|---|
| Code | The unique redemption code |
| Balance | Current remaining value |
| Initial value | Original card value at generation time |
| Status | active / redeemed / expired / disabled |
| Customer | Account linked to this code, if any |
| Order | The order this code was generated for |
| Expires | Expiry date (if configured), or — for no expiry |
Actions available from this tab:
- Search and filter by code, status, customer, or date
- Click a code to view its full transaction history (every partial redemption)
- Disable a code immediately (e.g., for fraud cases)
- Export the full list as CSV
Lists the available gift card designs — Twig-based templates used to generate the PDF voucher attached to the delivery email.
Each design has:
| Field | Description |
|---|---|
| Name | Internal label, e.g. "Birthday", "Corporate", "Holiday" |
| Twig template | The PDF layout — has access to code, amount, purchaser, and recipient variables |
| Background image | Optional background graphic for the voucher |
| Color scheme | Accent color used in the template |
Assigning designs to products:
Designs are assigned per gift card product in yStore → Products → [Gift Card Product] → Gift Card settings. Different gift card products can use different designs.
The Twig template for the PDF has access to these variables:
{{ code }}— the redemption code{{ amount }}— the card value with currency{{ purchaser }}— name of the person who bought the card{{ recipient }}— name of the intended recipient (if collected){{ expiresAt }}— expiry date, or null
Build your design in standard HTML/CSS — the system uses headless Chrome for PDF rendering, so full CSS3 is supported.
Lists every customer who currently holds an active gift card balance.
| Column | Description |
|---|---|
| Customer | Account name and email |
| Total balance | Combined remaining balance across all active codes |
| Active codes | Number of codes with a remaining balance |
Click a customer to see all their individual codes and balances.
How a gift card purchase works
- Customer adds a gift card product to the cart and completes checkout.
- yStore generates a unique code automatically as a background queue job.
- The code is stored in the Codes tab with its full initial value.
- The PDF voucher is generated using the design assigned to the product.
- A delivery email is sent to the purchaser's email (or a recipient email if you collect one at checkout) with the code and PDF attached.
Code generation runs as a queue job after order completion. On a busy server, there may be a short delay between order placement and email delivery. If a customer reports not receiving their code, check yStore → Jobs for any stuck or failed queue jobs.
How redemption works
At checkout, customers enter their gift card code in the payment step.
- The system validates the code: active status, not expired, balance > 0.
- The available balance is applied as a discount on the order total.
- If the order total exceeds the balance, the remainder is charged to the selected payment method.
- After the order is placed, the code balance is reduced by the amount used.
- If balance reaches €0, the code status changes to
redeemed.
Gift cards support partial redemption. A €50 card used on a €30 order retains a €20 balance and can be used again on a future order.
Configuration
Go to yStore → Settings → Sales → Marketing → Gift Cards.
| Setting | Description |
|---|---|
| Code length | Number of characters in generated codes |
| Code format | Character set: alphanumeric, numeric, or alpha-only |
| Code prefix | Optional prefix prepended to all codes, e.g. GC- |
| Default expiry (days) | Days from purchase until the code expires; set 0 for no expiry |
| Email template | The email template used for the delivery email |
| Allow combined payment | Whether customers can pay part gift card + part payment method |
Manual code generation (CLI)
You can generate codes outside the normal purchase flow — for example, to issue a refund as a gift card or to create promotional codes.
# Generate 10 codes worth €50 each in EUR
php craft yui/gift-card/generate --amount=50 --currency=EUR --count=10
# Generate with a specific design
php craft yui/gift-card/generate --amount=100 --currency=EUR --count=5 --design=corporate
# Output codes to a CSV file
php craft yui/gift-card/generate --amount=25 --currency=EUR --count=100 --output=/tmp/codes.csv
Generated codes are stored in the Codes tab and are immediately redeemable. They are not linked to any order.
Disabling a code
If a gift card code is reported stolen, fraudulently obtained, or needs to be invalidated:
- Go to
yStore → Marketing → Gift Cards → Codes. - Search for the code.
- Open the code detail and click Disable.
The code is immediately marked as disabled and cannot be redeemed. The remaining balance is frozen — it is not automatically transferred. If you need to re-issue the balance, generate a new code manually via the CLI.
Gift cards and flows
Gift cards can be integrated into automation flows:
| Flow action | What it does |
|---|---|
| Create Coupon → [gift card coupon type] | Issue a gift card code as a promotional reward |
Additionally, the gift card purchase order fires the standard Order Placed trigger, so you can build post-purchase flows that fire specifically for gift card orders by adding an Order Contains Product condition filtered to your gift card product.
See Flow Manager for details.
Common questions
Q: Can a customer have multiple gift card codes? Yes. Customers can hold and redeem multiple codes. At checkout they enter one code at a time; each applies its balance in sequence if multiple are used across multiple checkouts.
Q: What happens if the gift card product is deleted? Generated codes remain active and redeemable. The code record retains the original order and value regardless of whether the source product still exists.
Q: Can gift cards be used with coupons? Yes, unless the active coupon has exclusivity enabled. Gift card redemption and coupon discounts are independent — the gift card applies first, then the coupon discount, then the remaining balance is charged.
Q: Are gift cards taxable? In most jurisdictions, gift cards are not taxable at purchase — tax is collected when the card is redeemed and the underlying goods are purchased. Consult your accountant for your specific setup. yStore records the redemption amount per order for reporting purposes.