<order> tag allows you to display customer purchase history and order details on your pages. This is perfect for order confirmation pages, account pages, or any page where customers need to view their past purchases.
Overview
The order tag system dynamically displays purchase conversions grouped by session. It automatically shows all orders associated with the current customer’s email or session, making it easy to create personalized order history pages.Basic Usage
Simple Order Display
With Styling Attributes
You can add HTML attributes (likeclass or id) to the order tag:
Order Selection
The order tag automatically retrieves and displays orders based on the current customer session. Here’s how orders are selected:Selection Criteria
-
Customer Identification: Orders are retrieved using:
- The customer’s email address (if available in session)
- The current session ID (as a fallback)
-
Order Type Filtering: Only orders with
type="purchase"are displayed. This ensures that:- Only actual purchases are shown (not leads, opt-ins, or other conversion types)
- The order history is clean and relevant
- Security is maintained by filtering out non-purchase conversions
-
Grouping: Orders are grouped by
session_id, so multiple conversions from the same purchase session are displayed together as a single order.
Sorting Orders
By default, orders are displayed with the newest orders first. You can control the sort order using thesort-by attribute:
sort-by="newest"- Most recent orders first (default)sort-by="oldest"- Oldest orders first
Limiting Orders
You can limit the number of orders displayed using thelimit attribute:
- Must be a positive integer (1, 2, 3, etc.)
- If not specified, all orders are displayed
- Applied after sorting, so
limit="5"withsort-by="newest"shows the 5 newest orders
Combining Attributes
You can combinesort-by and limit with styling attributes:
Security & Data Protection
The order tag system includes built-in security measures:- Type Filtering: Only
type="purchase"conversions are displayed, preventing access to other conversion types - Input Validation: All attributes are validated and sanitized:
sort-byonly accepts"newest"or"oldest"(case-insensitive)limitmust be a positive integer- Invalid values are ignored and defaults are used
- Attribute Escaping: All attribute values are properly escaped to prevent injection attacks
- Session-Based Access: Orders are only shown to customers with valid sessions (email or customer flag)
Order-Level Placeholders
These placeholders work within the<order> tag to display order information:
{order_date}
Displays the formatted order date and time.
- Format: “Month Day, Year, Hour:Minute AM/PM”
- Example: “January 15, 2024, 2:30 PM”
{order_number}
Shows the public order ID for the purchase.
{billing_address}
Displays the complete billing address (address, city, state, zip).
{shipping_address}
Displays the complete shipping address (address, city, state, zip).
{order_status_text}
Order status text (currently empty, reserved for future use).
{charge_code}
Charge code information (currently empty, reserved for future use).
{customer_name}
Customer name placeholder. This works both inside and outside the order tag.
{customer_name} will be removed from the page. Use ,{customer_name} if you want the comma removed when the name is empty (e.g., “Hello, ” becomes “Hello” if no customer).
Nested Tags
Order Products
Use<order-product> to display individual products in an order. This tag automatically loops through all non-bonus products in the order.
Order Product Placeholders
{product_image_url}: URL of the product image{product_name}: Name of the product{price}: Formatted price with currency symbol (e.g., “$97.00”)
Bonus Products
Use<order-bonus-product> to display bonus products included with the order. Each bonus product is shown only once, even if it appears multiple times in the order.
Bonus Product Placeholders
{bonus_product_image_url}: URL of the bonus product image{bonus_product_name}: Name of the bonus product{bonus_download}: Download link/file for the bonus product
Order Product Tracking
The<order-product-tracking> tag is reserved for future tracking functionality. Currently, it returns empty content.
Complete Example
Here’s a complete example of an order history page:How It Works
- Customer Detection: The system checks if the visitor has a customer session (email or customer flag).
-
Order Retrieval: If a customer session exists, the system retrieves all conversions associated with:
- The customer’s email address (primary method)
- The current session ID (fallback method)
-
Order Filtering: Only conversions with
type="purchase"are included. This ensures:- Only actual purchases are displayed
- Other conversion types (leads, opt-ins, etc.) are excluded
- Security is maintained
-
Order Sorting: Orders are sorted based on the
sort-byattribute:"newest"(default): Most recent orders first"oldest": Oldest orders first- Sorting is based on the
created_attimestamp
-
Order Limiting: If a
limitattribute is specified, only that many orders are displayed (after sorting). -
Order Grouping: Orders are grouped by
session_id, so multiple conversions from the same purchase session are displayed together as a single order. -
Tag Processing:
- The
<order>tag is replaced with HTML for each order group - Nested tags (
<order-product>,<order-bonus-product>) are processed within each order - All placeholders are replaced with actual order data
- Attributes are validated and sanitized for security
- The
-
Empty State: If no customer session exists or no orders are found:
- The entire
<order>tag is removed from the page {customer_name}placeholders are removed- The page displays without order information
- The entire
Important Notes
Customer Session Required
The order tag only displays content when:- The visitor has a customer email in their session, OR
- The visitor has the
is_customerflag set in their session
Order Type Restriction
Only purchase orders are displayed. The system automatically filters to show only conversions withtype="purchase". This means:
- Leads, opt-ins, and other conversion types are never shown
- Only actual completed purchases appear in order history
- This is a security feature that cannot be overridden
Multiple Orders
If a customer has multiple orders (from different sessions), each order group will be displayed as a separate<order> block. The system automatically handles multiple orders and can sort/limit them as needed.
Sorting Behavior
- Default: Orders are sorted newest first
- Per-Tag: Each
<order>tag can have its ownsort-byandlimitattributes - Group Sorting: Orders are sorted by the first conversion’s
created_atdate within each session group
Styling
You can style order tags using CSS classes or IDs:<order> tag (except sort-by and limit) are applied to the wrapper <div> that contains each order.
Best Practices
- Always include order number: Use
{order_number}so customers can reference their orders - Show order date: Display
{order_date}to help customers identify when they made purchases - Organize products clearly: Use proper HTML structure and CSS to make product lists readable
- Handle empty states: Design your page to look good even when no orders are present
- Mobile responsive: Ensure your order display works well on mobile devices
- Test with multiple orders: Verify that multiple orders display correctly
Troubleshooting
Orders Not Showing
- Check customer session: Ensure the visitor is logged in or has a customer session
- Verify purchases: Confirm that purchase conversions exist for the customer
- Check order type: Only “purchase” type conversions are displayed
Customer Name Not Appearing
- The
{customer_name}placeholder requires at least one order to exist - If no orders exist, the placeholder is removed from the page
- Use
,{customer_name}if you want the comma removed when the name is empty
Products Not Displaying
- Ensure products are associated with the order conversions
- Check that products are not marked as bonus products (use
<order-bonus-product>for those) - Verify product data exists in the system