Shopify Integration

Integrate Loyalty.lt loyalty program seamlessly with your Shopify store to reward customers and boost engagement.
The Loyalty.lt Shopify integration works with all Shopify plans and supports both online stores and Shopify POS.

Overview

The Loyalty.lt Shopify integration provides:
  • Automatic Point Earning: Points awarded for purchases, reviews, referrals
  • Point Redemption: Customers redeem points for discounts and rewards
  • Loyalty Cards: Digital loyalty cards with QR codes
  • Games & Engagement: Interactive games and challenges
  • Customer Portal: Self-service loyalty dashboard
  • Multi-Store Support: Centralized loyalty across multiple Shopify stores

Key Features

For Customers

  • Automatic points on purchase
  • Point redemption for discounts
  • Digital loyalty card with QR code
  • Loyalty dashboard and history
  • Referral bonuses
  • Birthday rewards
  • Tier-based benefits

For Store Owners

  • Real-time customer analytics
  • Loyalty campaign management
  • Automated reward distribution
  • Customer segmentation
  • Performance tracking
  • Multi-language support

Installation Methods

Recommended for most users
  1. Visit the Shopify App Store
  2. Search for “Loyalty.lt”
  3. Click “Add app” on the Loyalty.lt listing
  4. Follow the installation prompts
  5. Complete the setup wizard
This method provides automatic updates and seamless integration

Configuration

Basic Setup

1

Connect Your Store

After installation, connect your Shopify store to Loyalty.lt:
// Automatic configuration via Shopify App
// No code required - handled by the app interface
2

Configure Point Rules

Set up how customers earn points:
{
  "earning_rules": {
    "purchase": {
      "rate": 1,
      "per_dollar": true,
      "minimum_order": 10
    },
    "signup": {
      "points": 100,
      "one_time": true
    },
    "referral": {
      "points": 500,
      "referee_bonus": 250
    }
  }
}
3

Set Redemption Options

Configure how points can be redeemed:
{
  "redemption_rules": {
    "discount": {
      "rate": 100,
      "per_dollar": true,
      "minimum_points": 500
    },
    "free_shipping": {
      "points_cost": 200,
      "minimum_order": 50
    }
  }
}

Advanced Configuration

Webhook Setup

Configure webhooks for real-time synchronization:
// Shopify webhook endpoints
const webhooks = {
  "orders/create": "https://api.loyalty.lt/webhooks/shopify/order-created",
  "orders/updated": "https://api.loyalty.lt/webhooks/shopify/order-updated",
  "customers/create": "https://api.loyalty.lt/webhooks/shopify/customer-created",
  "customers/update": "https://api.loyalty.lt/webhooks/shopify/customer-updated"
};

Custom Fields

Map Shopify customer fields to Loyalty.lt:
{
  "field_mapping": {
    "shopify_customer_id": "external_id",
    "email": "email",
    "first_name": "first_name",
    "last_name": "last_name",
    "phone": "phone",
    "birthday": "birth_date",
    "accepts_marketing": "marketing_consent"
  }
}

Customer Experience

Registration Flow

Customers are automatically enrolled when they:
  1. Create a Shopify account
  2. Make their first purchase
  3. Subscribe to newsletter
<!-- Shopify Liquid template -->
{% if customer %}
  <div class="loyalty-widget" data-customer-id="{{ customer.id }}">
    <h3>Welcome to our Loyalty Program!</h3>
    <p>You've earned {{ customer.metafields.loyalty.points }} points</p>
  </div>
{% endif %}

Points Earning

Purchase Points

<!-- Order confirmation page -->
{% if order.customer %}
  <div class="points-earned">
    <h4>🎉 You earned {{ order.total_price | times: 1 | round }} points!</h4>
    <p>Total points: {{ customer.metafields.loyalty.points }}</p>
  </div>
{% endif %}

Bonus Actions

// Award bonus points
LoyaltySDK.awardPoints({
  customerId: customer.id,
  points: 50,
  reason: 'Product review',
  orderId: order.id
});

Points Redemption

Discount Application

<!-- Cart page -->
{% if customer and customer.metafields.loyalty.points > 0 %}
  <div class="loyalty-redemption">
    <h4>Use {{ customer.metafields.loyalty.points }} points</h4>
    <button onclick="applyLoyaltyDiscount()">Apply ${{ customer.metafields.loyalty.points | divided_by: 100 }} discount</button>
  </div>
{% endif %}

Redemption Flow

function applyLoyaltyDiscount() {
  LoyaltySDK.redeemPoints({
    customerId: customer.id,
    points: pointsToRedeem,
    orderId: cart.token,
    onSuccess: function(discount) {
      // Apply discount code to cart
      applyShopifyDiscount(discount.code);
    }
  });
}

Admin Features

Customer Management

View customer loyalty data directly in Shopify admin:
// Customer metafields for loyalty data
{
  "loyalty": {
    "points": 1250,
    "tier": "gold",
    "lifetime_spent": 2500,
    "referrals": 3,
    "last_activity": "2024-01-15"
  }
}

Reporting & Analytics

Sales Impact

// Loyalty impact report
const report = await LoyaltySDK.getReport({
  type: 'loyalty_impact',
  dateRange: '30d',
  metrics: ['revenue', 'orders', 'redemptions']
});

Customer Insights

// Customer segmentation
const segments = await LoyaltySDK.getCustomerSegments({
  criteria: {
    points_range: [1000, 5000],
    tier: 'gold',
    last_purchase: '30d'
  }
});

Customization

Theme Integration

Loyalty Widget

<!-- Add to theme.liquid -->
<div id="loyalty-widget" 
     data-shop-id="{{ shop.permanent_domain }}"
     data-customer-id="{% if customer %}{{ customer.id }}{% endif %}">
</div>

<script src="https://cdn.loyalty.lt/shopify-widget.js"></script>

Point Display

<!-- Product page points preview -->
{% assign points_earned = product.price | times: 1 | round %}
<div class="points-preview">
  <span>Earn {{ points_earned }} points with this purchase</span>
</div>

Custom Liquid Tags

<!-- Loyalty balance -->
{{ customer | loyalty_points }}

<!-- Points earning preview -->
{{ product.price | points_preview }}

<!-- Tier status -->
{{ customer | loyalty_tier }}

<!-- Redemption options -->
{% loyalty_redemptions customer %}

Troubleshooting

Common Issues

Testing & Validation

1

Test Customer Registration

// Create test customer
const testCustomer = {
  email: 'test@example.com',
  first_name: 'Test',
  last_name: 'Customer'
};

LoyaltySDK.test.registerCustomer(testCustomer);
2

Test Points Earning

// Simulate order
LoyaltySDK.test.simulateOrder({
  customerId: 'test_customer_id',
  amount: 100,
  items: ['product_1', 'product_2']
});
3

Test Redemption

// Test point redemption
LoyaltySDK.test.redeemPoints({
  customerId: 'test_customer_id',
  points: 500
});

Performance Optimization

Caching Strategies

// Cache customer loyalty data
const cache = {
  duration: 300, // 5 minutes
  keys: ['points', 'tier', 'available_rewards']
};

LoyaltySDK.configure({
  cache: cache,
  lazy_load: true
});

Loading Optimization

<!-- Lazy load loyalty widget -->
<script async defer src="https://cdn.loyalty.lt/shopify-widget.js"></script>

<!-- Critical CSS for loyalty elements -->
<style>
.loyalty-widget { display: none; }
.loyalty-widget.loaded { display: block; }
</style>

Security Considerations

API Security

  • Use HTTPS for all API calls
  • Implement proper webhook verification
  • Secure customer data transmission
  • Regular security audits
// Webhook verification
const crypto = require('crypto');

function verifyWebhook(payload, signature) {
  const hmac = crypto.createHmac('sha256', process.env.LOYALTY_WEBHOOK_SECRET);
  hmac.update(payload);
  const calculatedSignature = hmac.digest('base64');
  
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(calculatedSignature)
  );
}

Data Protection

  • GDPR compliance for EU customers
  • Customer consent management
  • Data encryption in transit
  • Secure storage of customer data

Migration & Data Import

Existing Loyalty Program

// Import existing customer data
const migrationData = {
  customers: [
    {
      shopify_id: 'customer_123',
      email: 'customer@example.com',
      points: 1500,
      tier: 'gold',
      transactions: []
    }
  ]
};

LoyaltySDK.migrate.importData(migrationData);

Data Export

// Export loyalty data
const exportData = await LoyaltySDK.export.customerData({
  format: 'csv',
  fields: ['email', 'points', 'tier', 'lifetime_value']
});

Advanced Features

Multi-Store Management

// Configure multiple Shopify stores
LoyaltySDK.configure({
  stores: [
    { id: 'store1', domain: 'store1.myshopify.com' },
    { id: 'store2', domain: 'store2.myshopify.com' }
  ],
  shared_loyalty: true
});

API Extensions

// Custom loyalty rules
LoyaltySDK.extend({
  customRule: function(order, customer) {
    // Custom point calculation logic
    if (customer.tier === 'vip') {
      return order.total * 2; // Double points for VIP
    }
    return order.total;
  }
});

Automation & Workflows

// Automated campaigns
LoyaltySDK.automation.create({
  trigger: 'birthday',
  action: 'award_points',
  points: 100,
  message: 'Happy Birthday! Here are 100 bonus points!'
});

Support & Resources

Getting Help

Development Resources

Updates & Maintenance

  • Automatic app updates via Shopify App Store
  • Webhook health monitoring
  • Performance optimization recommendations
  • Security patch notifications

Next Steps