Loyalty Shortcodes
Display Square Loyalty program information using shortcodes on your WooCommerce store.
Use shortcodes to display loyalty program information anywhere on your site. Show points balances, rewards, progress bars, and more.
Requirements
Before using loyalty shortcodes:
- SquareSync for Woo Pro 7.7.0 or higher
- Loyalty program enabled in settings
- Customer linked to Square account
- Most shortcodes require user to be logged in
Available Shortcodes
Points Balance
Display the customer's current points balance.
[sws_loyalty_points]
Options:
| Attribute | Values | Default |
|---|---|---|
| format | simple, badge, detailed | simple |
| show_label | true, false | true |
| class | CSS class name | — |
Examples:
[sws_loyalty_points format="badge"]
[sws_loyalty_points format="detailed" show_label="false"]
Tier Status
Show the customer's current loyalty tier and progress to the next tier.
[sws_loyalty_tier]
Options:
| Attribute | Values | Default |
|---|---|---|
| show_next | true, false | true |
| class | CSS class name | — |
Example:
[sws_loyalty_tier show_next="true"]
Progress Bar
Display a visual progress bar toward the next reward.
[sws_loyalty_progress]
Options:
| Attribute | Values | Default |
|---|---|---|
| show_text | true, false | true |
| height | CSS value | 20px |
| color | CSS color | — |
| background | CSS color | — |
| class | CSS class name | — |
Examples:
[sws_loyalty_progress color="#4CAF50" height="30px"]
[sws_loyalty_progress show_text="false" background="#eee"]
Available Rewards
Show rewards the customer can redeem.
[sws_loyalty_rewards]
Options:
| Attribute | Values | Default |
|---|---|---|
| layout | list, grid, cards | list |
| show_qualified | true, false | true |
| show_unqualified | true, false | true |
| class | CSS class name | — |
Examples:
[sws_loyalty_rewards layout="grid"]
[sws_loyalty_rewards show_unqualified="false"]
Transaction History
Display the customer's points transaction history.
[sws_loyalty_history]
Options:
| Attribute | Values | Default |
|---|---|---|
| limit | Number | 10 |
| class | CSS class name | — |
Example:
[sws_loyalty_history limit="5"]
Earn Rate
Show how many points customers earn per dollar spent.
[sws_loyalty_earn_rate]
Options:
| Attribute | Values | Default |
|---|---|---|
| format | simple, detailed | simple |
| class | CSS class name | — |
This shortcode works for logged-out users too. Use it on marketing pages to promote your loyalty program.
Example:
[sws_loyalty_earn_rate format="detailed"]
Complete Widget
Display a comprehensive loyalty dashboard with multiple elements.
[sws_loyalty_widget]
Options:
| Attribute | Values | Default |
|---|---|---|
| title | Text | "Your Rewards" |
| show_points | true, false | true |
| show_progress | true, false | true |
| show_rewards | true, false | true |
| show_earn_rate | true, false | true |
| class | CSS class name | — |
Example:
[sws_loyalty_widget title="My Loyalty Status" show_history="true"]
Product Points
Show how many points a customer would earn from purchasing a specific product.
[sws_loyalty_product_points]
Options:
| Attribute | Values | Default |
|---|---|---|
| product_id | Product ID | Auto-detected |
| format | simple, detailed | simple |
| class | CSS class name | — |
Features:
- Auto-detects product on product pages
- Updates dynamically for variable products
- Shows points for selected variation
Examples:
[sws_loyalty_product_points]
[sws_loyalty_product_points product_id="123"]
Usage Examples
Account Page Widget
Add to customer account page:
[sws_loyalty_widget show_earn_rate="false"]
Product Page Incentive
Add to product template:
Earn [sws_loyalty_product_points format="simple"] points with this purchase!
Sidebar Widget
Add to sidebar:
[sws_loyalty_points format="badge"]
[sws_loyalty_progress height="10px"]
Dedicated Loyalty Page
Create a full loyalty page:
<h2>Your Loyalty Status</h2>
[sws_loyalty_points format="detailed"]
<h3>Progress to Next Reward</h3>
[sws_loyalty_progress]
<h3>Available Rewards</h3>
[sws_loyalty_rewards layout="cards"]
<h3>Recent Activity</h3>
[sws_loyalty_history limit="10"]
Styling
All shortcodes support custom CSS classes:
[sws_loyalty_points class="my-custom-class"]
Default Classes
Each shortcode outputs with default classes:
sws-loyalty-pointssws-loyalty-tiersws-loyalty-progresssws-loyalty-rewardssws-loyalty-historysws-loyalty-earn-ratesws-loyalty-widgetsws-loyalty-product-points
Custom CSS Example
.sws-loyalty-points.my-custom-class {
background: #f5f5f5;
padding: 1rem;
border-radius: 8px;
}Troubleshooting
Shortcode showing as text
- Verify SquareSync Pro is activated
- Check loyalty features are enabled
- Clear any caching plugins
No data displaying
- Confirm customer is logged in
- Verify customer is linked to Square
- Check loyalty program is configured
Incorrect points showing
- Refresh page to get latest data
- Check Square Dashboard for accurate balance
- Verify sync is working properly