Use Case
When an order is completed, you want to update the customer’s metadata with information about their purchase. This enables advanced segmentation, loyalty tracking, and personalized marketing.
Common scenarios:
- Track total lifetime purchases
- Record last purchase date
- Update loyalty point balance
- Flag product preferences
- Store purchase milestones
Step-by-Step Setup
1. Create a New Workflow
Navigate to Sequensy → Workflows in your WordPress admin and click Add New Workflow.
Name your workflow “Update Customer Stats on Order” or “Track Purchase History”.
2. Configure the Trigger
Select Order Completed as your trigger.
Available filters:
- Products: Update metadata for specific product purchases
- Categories: Track category preferences
- Order Total: Milestone tracking
3. Set Up the Update Customer Metadata Action
Configure the metadata update:
| Setting | Example Value | Description |
|---|---|---|
| Customer | {customer_id} | Target customer |
| Meta Key | last_purchase_date | The field to update |
| Meta Value | {current_date} | The new value |
| Update Type | Replace | Replace or append |
4. Track Multiple Fields
Create multiple metadata updates or workflows:
| Meta Key | Value | Purpose |
|---|---|---|
last_purchase_date | {current_date} | Recency tracking |
total_orders | {increment} | Frequency tracking |
lifetime_value | {add_order_total} | Monetary tracking |
favorite_category | {top_category} | Preference tracking |
5. Test Your Workflow
- Enable the workflow
- Complete a test order
- Check customer metadata in WooCommerce
- Verify values updated correctly
- Test with different order types
Pro Tips
Build RFM data: Track Recency, Frequency, and Monetary value for customer segmentation.
Use for loyalty programs: Increment points or tier progress with each purchase.
Preference tracking: Record what categories or products they buy most.
Milestone flags: Set flags like “has_purchased_premium” for targeted marketing.
Metadata Examples
Purchase Tracking
Meta Key: _last_order_date
Value: 2024-12-29
Meta Key: _total_completed_orders
Value: 15
Meta Key: _lifetime_spend
Value: 2450.00
Loyalty Program
Meta Key: _loyalty_points
Value: 1250 (updated: +{order_total})
Meta Key: _loyalty_tier
Value: Gold (updated based on points)
Meta Key: _points_earned_this_year
Value: 500
Product Preferences
Meta Key: _purchased_categories
Value: ["electronics", "accessories", "software"]
Meta Key: _favorite_brand
Value: Apple
Meta Key: _last_purchased_product
Value: iPhone Case
Customer Milestones
Meta Key: _first_purchase_date
Value: 2024-01-15
Meta Key: _is_repeat_customer
Value: yes
Meta Key: _vip_eligible
Value: yes (when lifetime_spend > 1000)
Using Metadata for Segmentation
Marketing Segments
| Segment | Metadata Query |
|---|---|
| Recent Buyers | last_order_date within 30 days |
| Big Spenders | lifetime_spend > $1000 |
| Loyal Customers | total_orders > 5 |
| At Risk | last_order_date > 90 days ago |
| VIP Candidates | lifetime_spend > $500 AND total_orders > 3 |
Email Targeting
Condition: _last_order_date > 60 days ago
Action: Send "We miss you" email with coupon
Condition: _total_orders = 5
Action: Send "Loyalty milestone" email
Condition: _lifetime_spend crosses $1000
Action: Send "VIP upgrade" email
Integration Ideas
CRM Sync
Update metadata that syncs with external CRMs:
- HubSpot custom properties
- Mailchimp merge fields
- Salesforce custom fields
Reporting
Query metadata for reports:
- Customer lifetime value trends
- Purchase frequency distribution
- Category preference analysis
Troubleshooting
Metadata not updating?
- Verify customer account exists
- Check meta key spelling
- Review workflow conditions
Wrong values stored?
- Check merge tag format
- Verify calculation logic
- Review data types
Can’t find metadata?
- Check in user meta table
- Use correct meta key prefix
- Review WooCommerce customer data location