Skip to main content

E-Commerce Loyalty Programs

Build comprehensive e-commerce loyalty programs that reward purchases, reviews, and customer milestones.

Overview

Reward customers for:

  • Purchases: 1-10 LTZ per dollar spent
  • First purchase: 200-500 LTZ bonus
  • Product reviews: 50-100 LTZ per review
  • Account creation: 100 LTZ
  • Milestones: Spending tiers, repeat purchases

Quick Implementation

We provide a production-ready integration template for Shopify stores.

The template handles:

  • Webhook verification
  • Automatic rewards for purchases (place_order)
  • Welcome bonuses (account_creation)
  • Referral rewards

Option 2: WooCommerce Integration

For WooCommerce, you can hook into the order completion action:

<?php
// functions.php

// Hook into order completion
add_action('woocommerce_order_status_completed', 'loyalteez_reward_purchase');

function loyalteez_reward_purchase($order_id) {
$order = wc_get_order($order_id);
$customer_email = $order->get_billing_email();
$total = $order->get_total();

// Prepare reward data
$data = array(
'brandId' => get_option('loyalteez_brand_id'),
'eventType' => 'place_order', // Standard event name
'userEmail' => $customer_email,
'domain' => get_site_url(),
'metadata' => array(
'platform' => 'woocommerce',
'order_id' => $order_id,
'total' => $total,
'currency' => $order->get_currency(),
'items_count' => $order->get_item_count()
)
);

// Send to Loyalteez API
wp_remote_post('https://api.loyalteez.app/loyalteez-api/manual-event', array(
'headers' => array('Content-Type' => 'application/json'),
'body' => json_encode($data)
));
}
?>

Option 3: Custom E-Commerce

// Node.js checkout handler
app.post('/api/checkout/complete', async (req, res) => {
const { orderId, customerEmail, total, items } = req.body;

try {
// Process payment
const payment = await processPayment(orderId);

if (payment.status === 'success') {
// Calculate LTZ reward (10 LTZ per $1)
const ltzReward = Math.floor(total * 10);

// Reward customer
await fetch('https://api.loyalteez.app/loyalteez-api/manual-event', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
brandId: process.env.LOYALTEEZ_BRAND_ID,
eventType: 'place_order',
userEmail: customerEmail,
domain: 'yourstore.com',
metadata: {
order_id: orderId,
total: total,
ltz_earned: ltzReward,
items: items.map(i => i.name).join(', ')
}
})
});

res.json({
success: true,
message: `Order complete! You earned ${ltzReward} LTZ!`
});
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});

Reward Strategies

Tiered Rewards

// Reward based on order value
function calculateLTZReward(orderTotal) {
if (orderTotal >= 200) {
return Math.floor(orderTotal * 15); // 15 LTZ per $1 for orders $200+
} else if (orderTotal >= 100) {
return Math.floor(orderTotal * 12); // 12 LTZ per $1 for orders $100+
} else {
return Math.floor(orderTotal * 10); // 10 LTZ per $1 standard
}
}

Product Category Bonuses

// Extra rewards for specific categories
function getCategoryBonus(items) {
let bonus = 0;

items.forEach(item => {
if (item.category === 'premium') {
bonus += 500; // 500 LTZ bonus per premium item
} else if (item.category === 'new_arrival') {
bonus += 250; // 250 LTZ bonus per new item
}
});

return bonus;
}

Product Review Rewards

Review Submission

// Reward for product reviews
app.post('/api/reviews/submit', async (req, res) => {
const { customerEmail, productId, rating, review } = req.body;

// Validate purchase logic here...

// Reward customer
const rewardAmount = rating >= 4 ? 100 : 50; // More LTZ for 4-5 star reviews

await fetch('https://api.loyalteez.app/loyalteez-api/manual-event', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
brandId: process.env.LOYALTEEZ_BRAND_ID,
eventType: 'product_review',
userEmail: customerEmail,
domain: 'yourstore.com',
metadata: {
product_id: productId,
rating: rating,
reward: rewardAmount
}
})
});

res.json({ success: true, ltz_earned: rewardAmount });
});

Next Steps

Support