# WPGens Documentation > Complete documentation for all WPGens WooCommerce plugins. ## Dynamic Coupons for Klaviyo ### Create Dynamic Coupons using Klaivyo Webhooks URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/create-dynamic-coupons-using-klaivyo-webhooks/ To create WooCommerce coupons using Klaviyo flows, you need to use the Webhook settings created by the plugin. You can find these settings on the Dynamic Coupon page. Follow the steps or the video tutorial below for details. ## Step 1: Create a Klaviyo Flow to Trigger Coupon Creation - In Klaviyo, go to **Flows** and click **Create Flow**. - Name it (e.g., “10% Off for New Customers”) and click **Create**. - Set the desired trigger, such as **Added to List**. - Save the trigger. ## Step 2: Add a Webhook Action in Klaviyo - In the flow, drag the **Webhook** action into your sequence. - From the plugin’s Dynamic Coupons page, copy the **Webhook URL** and paste it into the Webhook settings in Klaviyo. - Add two security headers: `woo-api-key` (value from the plugin) - `woo-api-secret` (value from the plugin) - Add the JSON body for the coupon (use the example from the plugin’s instructions). - Save the webhook. ## Step 3 – Create the Coupon Email in Klaviyo - In the flow, add an **Email** action after the webhook. - Name it (e.g., “Coupon Email”) and set the subject - Choose an existing template or create your own. - Replace any hardcoded coupon code in the email with the **Woo coupon** field created by the plugin: – Search for `dck` in personalization fields. – Select **Woo coupon** and insert it into the email body. - Save the email. ## Step 4 – Activate & Test Klaviyo Flow - Review your flow. - Turn it on and save. - Subscribe to the form that triggers the flow. - Check your email inbox for the coupon email. ## Step 5 – Verify Coupon Creation - In WooCommerce, go to **Coupons** to see the newly created coupon. - In Klaviyo, go to the customer’s **Profile** to see the coupon code and expiry date. ## Configuring Coupon Settings ![](https://woocommerce.com/wp-content/uploads/2025/08/image_cc216d.png?w=980) To configure coupon settings: - Navigate to WooCommerce > Klaviyo Coupons > Dynamic Coupons - Scroll to Coupon Settings section - Set the **coupon prefix** you want to use. All coupons created from Klaviyo webhooks will use this prefix. - Set the **default expiry days**. This determines the validity of the created coupons. - Enable **Auto Cleanup** to automatically remove expired coupons. --- ### Create Klaviyo Segment Coupons URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/create-klaviyo-segment-coupons/ The **Segment Coupons** feature in Dynamic Coupons for Klaviyo allows you to automatically apply WooCommerce coupons to customers who belong to specific Klaviyo lists or segments. This is perfect for rewarding VIP customers or offering exclusive discounts without requiring them to enter a code. Once configured, the discount is applied instantly at checkout whenever an eligible customer logs in, creating a seamless and personalized shopping experience. **Important Note:** This feature uses Klaviyo’s `getGroupMembership` API to identify user segments. It is available only for **Advanced KDP (Klaviyo Data Platform)** customers. Please ensure your Klaviyo plan includes Advanced KDP before enabling this feature. For more details about the `_klaviyo` JavaScript object and its capabilities, refer to the official Klaviyo documentation. ## Step 1 – Create the WooCommerce Coupon - In your WordPress dashboard, go to **WooCommerce → Coupons**. - Click **Add New**. - Enter a coupon code (e.g., `VIP10`). - Set the discount type to **Percentage Discount** and the amount to `10%`. - Save the coupon. ## Step 2 – Link the Coupon to a Klaviyo Segment - Go to the **Dynamic Coupons for Klaviyo** plugin settings page. - Select the **Segment Coupons** tab. - Click **Add Segment Coupon**. - Find your Klaviyo **Segment ID**: In Klaviyo, go to your desired **Segment** or **List**. - Open the **Settings** tab. - Copy the **List ID** from the *List ID* section. - Paste the Segment/List ID into the plugin’s **Segment ID** field. - Enter the coupon code you created in Step 1. - Click **Save**. ## Step 3 – Test the Segment Coupon - Log in to your site as a customer who belongs to the linked Klaviyo segment. - Add products to your cart. - Go to **Cart** or **Checkout** — the coupon should already be applied automatically. ## Step 4 – Hide the Segment Coupon (Optional) - In the plugin settings, go to the **Hidden Coupons** section. - Enable **Hide Segment Coupons**. - Click **Save**. - Refresh the checkout page — the coupon code will no longer be visible, but the discount will still be applied. --- ### Getting Started URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/getting-started-wtih-dynamic-coupons-for-klaviyo/ [Dynamic Coupons for Klaviyo](https://wpgens.com/downloads/dynamic-coupons-for-klaviyo-for-woocommerce/) allows your WooCommerce store to automatically create, apply, and manage discount coupons directly through Klaviyo flows and segments. Additionally, you can track advanced WooCommerce events in Klaviyo and use them to create segments or automate flows, and hide coupon codes at checkout for a seamless customer experience—all without manually creating or managing coupons in WooCommerce. ## Step 1 – Install the plugin - Download the plugin **ZIP file** - In WordPress, go to ** Plugins > Add Plugin** - Click **Upload Plugin** > **Choose File** - Select the **ZIP file** from your computer - Click** Install Now** - Click **Activate** ## Step 2 – Add your licence key - In WordPress, go to **WooCommerce > Klaviyo Coupons** - Click **Automatic Updates** - Enter the **Licence Key** your received via email and click **Save** ## Step 3 – Connect with Klaviyo - Create a new **Private API key** in Klaviyo with **Full Access**. You can follow the steps in the [official Klaviyo documentation](https://help.klaviyo.com/hc/en-us/articles/7423954176283) or watch [this tutorial.](https://youtu.be/INudPz35ipE?si=pPaqk9mkXs46M4D2) - Go to: **WooCommerce > Klaviyo Coupons > Dynamic Coupons** - Enter your Klaviyo API key - Click **Validate and Save** You are now ready to use the plugin. --- ### Hide Coupons URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/hide-coupons/ You can use the **hidden coupons** feature to hide Dynamic Coupons, Segment Coupons or any coupon that matches a custom pattern. ![](https://wpgens.com/wp-content/uploads/2025/08/03.png) **To hide a coupon pattern:** - Go to **WooCommerce > Klaviyo Coupons > Hidden Coupons** - In the **Hide Coupon Pattern** section, enter a pattern to hide. For example, if you enter “KLV-*”, all coupons that start with “KLV-” will be hidden. Use * as a wildcard. - Click **Save**. All coupons matching the set pattern will now be hidden during checkout. **To hide dynamic coupons:** - Go to **WooCommerce > Klaviyo Coupons > Hidden Coupons** - Turn on **Hide Dynamic Coupons** toggle - Click **Save**. All coupons generated using the Dynamic Coupons feature will now be hidden during checkout. Important: this will hide the dynamic coupons based on the current coupon prefix configured on the Dynamic Coupons page. If you change this prefix after some dynamic coupons have already been created, the coupons with the old prefix will not be hidden. To hide them, use the Hide Coupon Pattern feature described above. **To hide segment coupons:** - Go to **WooCommerce > Klaviyo Coupons > Hidden Coupons** - Turn on **Hide Segment Coupons** toggle - Click **Save**. All coupons generated using the Segment Coupon feature will now be hidden during checkout. --- ### Send Advanced WooCommerce Events to Klaviyo URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/send-advanced-woocommerce-events-to-klaviyo/ The **Advanced Events** feature in Dynamic Coupons for Klaviyo lets you send detailed, custom tracking events from WooCommerce to Klaviyo. In addition to standard page view event, you can enable tracking for custom post views, category views, and WooCommerce Subscription events. All events are sent with useful details (e.g., category name, page URL) and can be used in Klaviyo Flows or segments to create highly targeted campaigns. ## Step 1 – Enable Advanced Events in the Plugin - In your WordPress dashboard, open the **Dynamic Coupons for Klaviyo** plugin. - Navigate to the **Advanced Events** page. - Select the events you want to track (e.g., **Product Category Views**). - Click **Save**. ## Step 2 – Test the Event Tracking - On your WooCommerce site, perform the action you enabled tracking for — for example, open a product category page like **Jackets**. - In Klaviyo, go to **Analytics → Metrics** (or the event stream) and refresh the page. - Look for the newly captured event (e.g., `View Product Category`) along with its details such as category name and page URL. ## Step 3 – Use the Event in Klaviyo - In Klaviyo, create or edit a **Flow** or **Segment**. - Use your custom event as a trigger or filter. - Build automations or personalized campaigns based on this event data. --- ## Points and Rewards for WooCommerce ### Adding Custom Actions to Award or Deduct Points URL: https://wpgens.com/docs/loyalty-program/adding-custom-actions-to-award-or-deduct-points/ With the **WPGens Points and Rewards for WooCommerce** plugin, you can go beyond the default earning rules and award or deduct points based on custom actions performed by your users. This is useful when you want to reward customer engagement outside the usual order flow – such as completing a quiz, interacting on social media, or performing actions tracked by other plugins. By using the `wpgens_loyalty_update_points` action hook, you can seamlessly integrate these events into your loyalty program and keep point tracking consistent across your store. ``` **Custom Point Actions & Integrations** You can add custom point actions by using the `wpgens_loyalty_update_points` action. Here are some examples: ```php // Award points for a custom action function award_custom_points($user_id, $points, $description) { do_action( 'wpgens_loyalty_update_points', $user_id, $points, 'add', 'custom_action', null, $description ); } // Example: Award points for completing a quiz add_action('quiz_completed', function($user_id, $quiz_id) { $points = 100; // Award 100 points $description = sprintf('Completed quiz #%d', $quiz_id); award_custom_points($user_id, $points, $description); }); // Example: Award points for social media engagement add_action('social_media_engagement', function($user_id, $platform, $action) { $points = 50; // Award 50 points $description = sprintf('Engaged on %s: %s', $platform, $action); award_custom_points($user_id, $points, $description); }); // Example: Integration with another plugin add_action('other_plugin_custom_event', function($user_id, $event_data) { // Calculate points based on event data $points = calculate_points_from_event($event_data); $description = sprintf('Completed %s', $event_data['event_name']); do_action( 'wpgens_loyalty_update_points', $user_id, $points, 'add', 'other_plugin', $event_data['event_id'], $description ); }); // Example: Deduct points for a penalty function deduct_points_penalty($user_id, $points, $reason) { do_action( 'wpgens_loyalty_update_points', $user_id, $points, 'deduct', 'penalty', null, $reason ); } ``` **Integration Best Practices** 1. Always use meaningful `$source` values to track where points came from 2. Include relevant `$reference_id` when available (e.g. order ID, post ID) 3. Use descriptive `$description` for better tracking 4. Consider adding your own hooks to allow others to extend your integration 5. Test points updates in test mode first 6. Handle errors gracefully and log them if needed ``` --- ### Automatically Apply Points at Checkout URL: https://wpgens.com/docs/loyalty-program/automatically-apply-points-at-checkout/ If you have Points to Currency Conversion turned on, you might want to automatically apply all available points at checkout. To do this, insert the following JavaScript snippet into your website header or footer. The script works both with block-based checkout and standard checkout. ``` function wpgAutoApplyPoints() { const observer = new MutationObserver(function(mutations) { const checkoutUIElement = document.querySelector('.wpgens-points-checkout-ui'); if (checkoutUIElement) { const loyaltyButton = checkoutUIElement.querySelector('button.wpgens-loyalty-button'); if (loyaltyButton) { setTimeout(() => { if (!loyaltyButton.classList.contains('wpgens-loyalty-remove-discount-btn')) { loyaltyButton.click(); } }, 200); observer.disconnect(); return; } } }); observer.observe(document.body, { childList: true, subtree: true }); setTimeout(() => { observer.disconnect(); }, 10000); } document.addEventListener('DOMContentLoaded', wpgAutoApplyPoints); ``` --- ### Brevo Integration: Events and Contact Attributes Reference URL: https://wpgens.com/docs/loyalty-program/brevo-events-contact-attributes-loyalty-program/ The Brevo integration keeps your contact records in sync with loyalty data through **contact attributes** (always-on profile data) and **track events** (fired when specific actions happen). Both can be used in Brevo’s automation workflows to send targeted emails based on loyalty activity. ## Contact Attributes Contact attributes are updated directly on the Brevo contact record automatically when data changes. Attributes of type **Date** (such as `LOYALTY_BIRTHDAY`) must be created manually in Brevo before the first sync. Go to **Contacts → Settings → Contact Attributes** to add them. Other attributes are created automatically on first sync. AttributeTypeWhen UpdatedDescription`LOYALTY_POINTS_BALANCE`NumberEvery points transactionThe customer’s current points balance.`LOYALTY_POINTS_LAST_UPDATED`Text (ISO 8601)Every points transactionTimestamp of the most recent points change.`LOYALTY_REFERRAL_CODE`TextEvery points transactionThe customer’s unique referral code. Only present if the referral module is active.`LOYALTY_BIRTHDAY`Date (YYYY-MM-DD)When customer saves their birthdayThe customer’s birthday. Use as the trigger date for a Brevo anniversary automation.`FIRSTNAME`TextEvery points transactionCustomer’s first name, synced from WordPress.`LASTNAME`TextEvery points transactionCustomer’s last name, synced from WordPress. ## Track Events Track events are sent to the Brevo Marketing Automation API and can be used as triggers or conditions in Brevo automation workflows. ### Points Updated Fired on every points transaction: earning, spending, expiring, and manual adjustments. PropertyTypeDescription`delta`IntegerPoints change. Positive for earned, negative for spent or expired.`balance_after`IntegerPoints balance after the transaction.`reason_title`StringHuman-readable reason for the change. See the full list below.`source`StringMachine-readable source type.`awarded_at`ISO 8601 datetimeTimestamp of the transaction. **All possible `reason_title` values:** reason_titleWhen it firesOrder purchaseCustomer earns points for placing an order.Order discountCustomer redeems points for a discount on an order.Order cancelledPoints are reversed when an order is cancelled.Order refundedPoints are reversed when an order is refunded.Product reviewCustomer earns points for leaving a product review.Friend referralCustomer earns points for referring a friend.Manual adjustmentAn admin manually adds or removes points.Registration bonusCustomer earns points for creating an account.Birthday bonusPoints awarded on the customer’s birthday.Imported pointsPoints added via CSV import.Points expiredPoints removed due to inactivity expiry. ### Rank Achieved Fired when a customer reaches a new rank tier. PropertyTypeDescription`rank_id`IntegerID of the new rank.`rank_name`StringDisplay name of the new rank.`rank_milestone`IntegerPoints threshold for the new rank.`previous_rank_name`StringName of the previous rank. Not present on first rank.`achieved_at`ISO 8601 datetimeTimestamp when the rank was achieved.`coupon_code`StringThe coupon code issued as a rank reward. Only present when a coupon is configured for this rank.`coupon_codes`ArrayAll coupon codes issued when the rank has multiple rewards configured. Only present when more than one coupon is issued. ## Using Events in Brevo Automations In Brevo, go to **Automations** and create a new workflow. Choose **Specific event** as the entry point and enter the event name (`Points Updated` or `Rank Achieved`). Add conditions on event properties to filter by activity. For example, filter on `reason_title = Order purchase` to send a points earned confirmation after every purchase, or `reason_title = Points expired` to send a re-engagement email when points expire. For date-based birthday emails, use the **Anniversary date** trigger on the `LOYALTY_BIRTHDAY` contact attribute instead. This approach sends annually on the stored date regardless of other events. --- ### Conditional Coupon Rules URL: https://wpgens.com/docs/loyalty-program/conditional-coupon-rules/ While basic redemption actions work well for general use, sometimes you want tighter control over how rewards are used. This guide walks you through setting up an advanced percentage-based reward with optional restrictions and logic – perfect for stores with specific product, category, or usage conditions. ## Example Setup: “10% Off Any Product” Reward We’ll configure a reward that costs **200 points** and gives **10% off** across all products, with optional limitations available if needed. ### Step-by-Step Configuration - Go to **Points & Rewards > Setup > Ways to Redeem** - Click **Add redemption action** or edit an existing one #### **Basic settings** FieldExample ValueDescription**Title**10% off any productThis appears in the customer’s rewards list**Points cost**200Number of points required to claim this reward**Coupon type**Percentage DiscountType of discount applied**Coupon Amount**10Percentage discount (10% in this case)**Enabled**✅Toggle this on to make the reward active #### Optional Conditions FieldDescription**Minimum Spent**(Optional) Set a minimum cart subtotal required to use the coupon**Coupon Duration**Enter how many days the coupon will be valid (e.g., 30 for 30 days)**Reward Specific Coupon Prefix**Prefix for coupon codes (e.g., promo_ will create promo_abcd12) ## Product & Category Rules These fields let you fine-tune where the coupon applies: - **Include Products**: Coupon will only apply if these products are in the cart. - **Exclude Products**: These products will never receive the discount. - **Include Categories**: Coupon only applies to products in these categories. - **Exclude Categories**: Products in these categories will not be discounted. **Tip:** Want to prevent discounts on premium items? Add them to the *Exclude Products* list. ## Save and Test After entering your values: - Click **Save** - Use **Test Mode** to redeem the reward as an admin and simulate the cart conditions - Confirm the coupon applies as expected under the defined restrictions --- ### Use Case Variations Here are a few variations you can create using these same settings: - Free Shipping for Specific Categories - 20% Off Sale Items Only - $10 Off Orders Over $100 --- ### Create Dynamic Coupons using Klaivyo Webhooks URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/create-dynamic-coupons-using-klaivyo-webhooks/ To create WooCommerce coupons using Klaviyo flows, you need to use the Webhook settings created by the plugin. You can find these settings on the Dynamic Coupon page. Follow the steps or the video tutorial below for details. ## Step 1: Create a Klaviyo Flow to Trigger Coupon Creation - In Klaviyo, go to **Flows** and click **Create Flow**. - Name it (e.g., “10% Off for New Customers”) and click **Create**. - Set the desired trigger, such as **Added to List**. - Save the trigger. ## Step 2: Add a Webhook Action in Klaviyo - In the flow, drag the **Webhook** action into your sequence. - From the plugin’s Dynamic Coupons page, copy the **Webhook URL** and paste it into the Webhook settings in Klaviyo. - Add two security headers: `woo-api-key` (value from the plugin) - `woo-api-secret` (value from the plugin) - Add the JSON body for the coupon (use the example from the plugin’s instructions). - Save the webhook. ## Step 3 – Create the Coupon Email in Klaviyo - In the flow, add an **Email** action after the webhook. - Name it (e.g., “Coupon Email”) and set the subject - Choose an existing template or create your own. - Replace any hardcoded coupon code in the email with the **Woo coupon** field created by the plugin: – Search for `dck` in personalization fields. – Select **Woo coupon** and insert it into the email body. - Save the email. ## Step 4 – Activate & Test Klaviyo Flow - Review your flow. - Turn it on and save. - Subscribe to the form that triggers the flow. - Check your email inbox for the coupon email. ## Step 5 – Verify Coupon Creation - In WooCommerce, go to **Coupons** to see the newly created coupon. - In Klaviyo, go to the customer’s **Profile** to see the coupon code and expiry date. ## Configuring Coupon Settings ![](https://woocommerce.com/wp-content/uploads/2025/08/image_cc216d.png?w=980) To configure coupon settings: - Navigate to WooCommerce > Klaviyo Coupons > Dynamic Coupons - Scroll to Coupon Settings section - Set the **coupon prefix** you want to use. All coupons created from Klaviyo webhooks will use this prefix. - Set the **default expiry days**. This determines the validity of the created coupons. - Enable **Auto Cleanup** to automatically remove expired coupons. --- ### Create Klaviyo Segment Coupons URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/create-klaviyo-segment-coupons/ The **Segment Coupons** feature in Dynamic Coupons for Klaviyo allows you to automatically apply WooCommerce coupons to customers who belong to specific Klaviyo lists or segments. This is perfect for rewarding VIP customers or offering exclusive discounts without requiring them to enter a code. Once configured, the discount is applied instantly at checkout whenever an eligible customer logs in, creating a seamless and personalized shopping experience. **Important Note:** This feature uses Klaviyo’s `getGroupMembership` API to identify user segments. It is available only for **Advanced KDP (Klaviyo Data Platform)** customers. Please ensure your Klaviyo plan includes Advanced KDP before enabling this feature. For more details about the `_klaviyo` JavaScript object and its capabilities, refer to the official Klaviyo documentation. ## Step 1 – Create the WooCommerce Coupon - In your WordPress dashboard, go to **WooCommerce → Coupons**. - Click **Add New**. - Enter a coupon code (e.g., `VIP10`). - Set the discount type to **Percentage Discount** and the amount to `10%`. - Save the coupon. ## Step 2 – Link the Coupon to a Klaviyo Segment - Go to the **Dynamic Coupons for Klaviyo** plugin settings page. - Select the **Segment Coupons** tab. - Click **Add Segment Coupon**. - Find your Klaviyo **Segment ID**: In Klaviyo, go to your desired **Segment** or **List**. - Open the **Settings** tab. - Copy the **List ID** from the *List ID* section. - Paste the Segment/List ID into the plugin’s **Segment ID** field. - Enter the coupon code you created in Step 1. - Click **Save**. ## Step 3 – Test the Segment Coupon - Log in to your site as a customer who belongs to the linked Klaviyo segment. - Add products to your cart. - Go to **Cart** or **Checkout** — the coupon should already be applied automatically. ## Step 4 – Hide the Segment Coupon (Optional) - In the plugin settings, go to the **Hidden Coupons** section. - Enable **Hide Segment Coupons**. - Click **Save**. - Refresh the checkout page — the coupon code will no longer be visible, but the discount will still be applied. --- ### Disable Points for Specific Products URL: https://wpgens.com/docs/loyalty-program/disable-points-for-specific-products/ You can disable points earning for specific products using the `wpgens_loyalty_disable_product_points` filter: ``` add_filter('wpgens_loyalty_disable_product_points', function($disabled, $product) { // Disable points for product ID 123. Replace 123 with your product ID. if ($product->get_id() === 123) { return true; } // Disable points for the shoes product category. Replace shoes with a desired category name. if (has_term('shoes', 'product_cat', $product->get_id())) { return true; } return $disabled; }, 10, 2); ``` This filter allows you to: - Disable points for specific product IDs - Disable points for products in certain categories - Disable points based on any custom logic you need The filter receives two parameters: - `$disabled` (boolean): Current disabled status - `$product_id` (int): The product ID to check Return `true` to disable points for the product, `false` to allow points. --- ### Disable Points for Specific User Role URL: https://wpgens.com/docs/loyalty-program/disable-points-for-specific-user-role/ You can disable points for specific user roles by adding below code to functions.php: ``` add_filter('wpgens_loyalty_should_allow_points_for_user', 'filter_points_by_user_role', 10, 5); function filter_points_by_user_role($should_allow, $user_id, $source, $type, $points_delta) { // Define roles that should be excluded from points system $excluded_roles = ['wholesale']; // Get user object $user = get_userdata($user_id); if (!$user) { return $should_allow; // User not found, keep default behavior } // Check if user has any excluded roles $user_roles = (array) $user->roles; $has_excluded_role = array_intersect($user_roles, $excluded_roles); if (!empty($has_excluded_role)) { WPGL_Logger::points("Points update blocked for excluded role", [ 'user_id' => $user_id, 'user_roles' => $user_roles, 'excluded_roles' => $excluded_roles, 'points_delta' => $points_delta, 'source' => $source ]); return false; // Block the points update } // Allow points update to continue return $should_allow; } ``` --- ### Filter Action List – Advanced Customization and Integration URL: https://wpgens.com/docs/loyalty-program/filter-action-list/ # Developer Documentation – WPGens Points and Rewards Plugin For advanced customization and integration, the Points and Rewards plugin provides full support for template overrides, hooks, and filters. This section is intended for developers who want to extend or modify plugin behavior beyond the standard settings available in the admin dashboard. --- ## Template Overrides You can override any template by copying it to your theme directory. The plugin will look for templates in the following order: - `your-theme/wpgens-loyalty/template-name.php` - `your-theme/template-name.php` - `plugin/templates/template-name.php` ### Available Templates to Override - **points-page.php** – Main points and rewards page - **points-earn.php** – Points earning section - **points-redeem.php** – Points redemption section - **points-rewards.php** – Rewards history section - **points-stats.php** – Points statistics section - **points-history.php** – Points transaction history - **myaccount-loyalty-points.php** – My Account loyalty points tab - **points-page-guest.php** – Guest user points page - **refer-a-friend.php** – Referral program page --- ## Action Hooks ### Plugin Lifecycle Actions #### `wpgens_loyalty_activate` Fires when plugin is activated. **Parameters:** None ``` add_action('wpgens_loyalty_activate', function() { // Custom setup when plugin is activated flush_rewrite_rules(); }); ``` #### `wpgens_loyalty_deactivate` Fires when plugin is deactivated. **Parameters:** None ``` add_action('wpgens_loyalty_deactivate', function() { // Custom cleanup when plugin is deactivated }); ``` --- ### Points Management Actions #### `wpgens_loyalty_update_points` Fires whenever points are added or deducted. **Parameters:** - `$user_id` (int) - `$points` (int) - `$type` (string) - `$source` (string) - `$reference_id` (int|null) - `$description` (string) ``` add_action('wpgens_loyalty_update_points', function($user_id, $points, $type, $source, $reference_id, $description) { if ($source === 'custom_action') { error_log("Points {$type} for user {$user_id}: {$points} points"); } }); ``` #### `wpgens_loyalty_points_updated` Fires after points are successfully updated. ``` add_action('wpgens_loyalty_points_updated', function($user_id, $new_balance, $points_delta, $type, $source) { update_user_meta($user_id, 'last_points_update', time()); }); ``` #### `wpgens_loyalty_points_expired` Fires when points expire due to inactivity. ``` add_action('wpgens_loyalty_points_expired', function($user_id, $current_balance, $expiration_period) { wp_mail( get_userdata($user_id)->user_email, 'Points Expired', "Your {$current_balance} points have expired due to {$expiration_period} days of inactivity." ); }); ``` --- ### Checkout and Redemption Actions #### `wpgens_loyalty_points_redeemed_at_checkout` ``` add_action('wpgens_loyalty_points_redeemed_at_checkout', function($user_id, $points_redeemed, $discount_amount, $order_id, $order) { error_log("User {$user_id} redeemed {$points_redeemed} points for " . wc_price($discount_amount) . " discount on order {$order_id}"); }); ``` #### `wpgens_points_applied_subscription_renewal` ``` add_action('wpgens_points_applied_subscription_renewal', function($user_id, $order_id, $points_used, $discount_amount) { update_user_meta($user_id, 'subscription_points_used', $points_used); }); ``` --- ### Cron Actions #### `wpgens_loyalty_daily_cron` ``` add_action('wpgens_loyalty_daily_cron', function() { cleanup_old_data(); }); ``` --- ## Filter Hooks ### Template Filters #### `wpgens_loyalty_locate_template` ``` add_filter('wpgens_loyalty_locate_template', function($template, $template_name) { if ($template_name === 'points-page.php') { return get_template_directory() . '/custom-points-page.php'; } return $template; }, 10, 2); ``` #### `wpgens_loyalty_get_template` ``` add_filter('wpgens_loyalty_get_template', function($template_path, $template_name, $args) { return $template_path; }, 10, 3); ``` #### `wpgens_loyalty_template_args` ``` add_filter('wpgens_loyalty_template_args', function($args, $template_name) { if ($template_name === 'points-page.php') { $args['custom_data'] = 'value'; $args['user_level'] = get_user_meta(get_current_user_id(), 'loyalty_level', true); } return $args; }, 10, 2); ``` ### Points Calculation Filters #### `wpgens_loyalty_should_calculate_item_points` Control whether points should be calculated for a specific item. **Recommended for modern integrations.** ``` add_filter('wpgens_loyalty_should_calculate_item_points', function($should_calculate, $product, $quantity) { if ($product->get_type() === 'composite') { return has_composite_parent($product) ? false : true; } if ($product->get_meta('_disable_loyalty_points') === 'yes') { return false; } if ($quantity > 10) { return false; } return $should_calculate; }, 10, 3); ``` --- #### `wpgens_loyalty_item_price_for_points` Override the price used for points calculation. ``` add_filter('wpgens_loyalty_item_price_for_points', function($price, $product, $quantity) { if ($product->get_type() === 'composite') { return $product->get_meta('_base_price', true) ?: $price; } if ($quantity >= 5) { return $price * 0.9; // 10% discount for bulk orders } return $price; }, 10, 3); ``` --- #### `wpgens_loyalty_item_points_calculated` Override the final calculated points for an item. ``` add_filter('wpgens_loyalty_item_points_calculated', function($final_points, $product, $quantity, $base_points) { if (is_user_logged_in() && wp_get_current_user()->user_registered > strtotime('-30 days')) { return $final_points * 2; } if (has_term('premium', 'product_cat', $product->get_id())) { return $final_points + 50; } return $final_points; }, 10, 4); ``` --- #### `wpgens_loyalty_cart_points_before_discount` ``` add_filter('wpgens_loyalty_cart_points_before_discount', function($total_points, $cart) { $max_points = 1000; if ($total_points > $max_points) { return $max_points; } $cart_total = $cart->get_total('edit'); if ($cart_total > 500) { return $total_points + 100; } return $total_points; }, 10, 2); ``` --- #### `wpgens_loyalty_order_points_before_discount` ``` add_filter('wpgens_loyalty_order_points_before_discount', function($total_points, $order) { if ($order->get_payment_method() === 'cod') { return $total_points + 25; } return $total_points; }, 10, 2); ``` --- ### Points Earning Control Filters #### `wpgens_loyalty_disable_earning_when_points_used` ``` add_filter('wpgens_loyalty_disable_earning_when_points_used', function($disable_earning, $applied_coupon) { if (isset($applied_coupon['amount']) && $applied_coupon['amount'] > 50) { return true; } if (isset($applied_coupon['points']) && $applied_coupon['points'] > 100) { return true; } return false; }, 10, 2); ``` --- #### `wpgens_loyalty_should_award_review_points` ``` add_filter('wpgens_loyalty_should_award_review_points', function($should_award, $data) { return $data['total_reviews'] < 3; }, 10, 2); ``` --- #### `wpgens_loyalty_should_allow_points_for_user` ``` add_filter('wpgens_loyalty_should_allow_points_for_user', function($should_allow, $user_id, $source, $type, $points_delta) { $user = get_userdata($user_id); $allowed_roles = ['customer', 'premium_customer']; if (!$user || !array_intersect($user->roles, $allowed_roles)) { return false; } $is_premium_member = get_user_meta($user_id, 'premium_member', true); if ($is_premium_member !== 'yes') { return false; } return true; }, 10, 5); ``` --- ### UI Control Filters #### `wpgens_loyalty_show_loyalty_points_tab` ``` add_filter('wpgens_loyalty_show_loyalty_points_tab', function($show_tab, $user_id) { $user = get_userdata($user_id); return $user && in_array('premium_customer', $user->roles); }, 10, 2); ``` --- #### `wpgens_loyalty_show_loyalty_points_content` ``` add_filter('wpgens_loyalty_show_loyalty_points_content', function($show_content, $user_id) { $is_premium_member = get_user_meta($user_id, 'premium_member', true); return $is_premium_member === 'yes'; }, 10, 2); ``` --- #### `wpgens_loyalty_show_points_redemption_block` ``` add_filter('wpgens_loyalty_show_points_redemption_block', function($show_block) { $user = wp_get_current_user(); return !in_array('wholesale_customer', $user->roles); }); ``` --- #### `wpgl_show_points_earning_box` ``` add_filter('wpgl_show_points_earning_box', function($should_show) { return !wp_is_mobile(); }); ``` --- ### System Configuration Filters #### `wpgens_loyalty_expiry_warning_days` ``` add_filter('wpgens_loyalty_expiry_warning_days', function($days) { return 14; // Send warning 14 days before expiry }); ``` --- #### `wpgens_loyalty_is_using_cart_checkout_block` ``` add_filter('wpgens_loyalty_is_using_cart_checkout_block', function($value, $post) { return has_block('woocommerce/cart', $post); }, 10, 2); ``` --- #### `wpgens_loyalty_cancelled_order_statuses` ``` add_filter('wpgens_loyalty_cancelled_order_statuses', function($statuses) { $statuses[] = 'refunded'; return $statuses; }); ``` ## Advanced Usage Examples ### Custom Points Integration ``` function award_custom_points($user_id, $points, $description) { do_action( 'wpgens_loyalty_update_points', $user_id, $points, 'add', 'custom_action', null, $description ); } add_action('quiz_completed', function($user_id, $quiz_id) { $points = 100; $description = sprintf('Completed quiz #%d', $quiz_id); award_custom_points($user_id, $points, $description); }); add_action('social_media_engagement', function($user_id, $platform, $action) { $points = 50; $description = sprintf('Engaged on %s: %s', $platform, $action); award_custom_points($user_id, $points, $description); }); ``` --- ### Role-Based Access Control ``` function wpgens_setup_role_based_points() { $allowed_roles = ['customer', 'premium_customer']; add_filter('wpgens_loyalty_should_allow_points_for_user', function($should_allow, $user_id, $source, $type, $points_delta) use ($allowed_roles) { $user = get_userdata($user_id); return $user && array_intersect($user->roles, $allowed_roles); }, 10, 5); add_filter('wpgens_loyalty_show_loyalty_points_tab', function($show_tab, $user_id) use ($allowed_roles) { $user = get_userdata($user_id); return $user && array_intersect($user->roles, $allowed_roles); }, 10, 2); add_filter('wpgens_loyalty_show_loyalty_points_content', function($show_content, $user_id) use ($allowed_roles) { $user = get_userdata($user_id); return $user && array_intersect($user->roles, $allowed_roles); }, 10, 2); } add_action('init', 'wpgens_setup_role_based_points'); ``` --- ### User Meta-Based Access Control ``` add_filter('wpgens_loyalty_should_allow_points_for_user', function($should_allow, $user_id, $source, $type, $points_delta) { $is_premium_member = get_user_meta($user_id, 'premium_member', true); return $is_premium_member === 'yes'; }, 10, 5); add_filter('wpgens_loyalty_show_loyalty_points_tab', function($show_tab, $user_id) { $is_premium_member = get_user_meta($user_id, 'premium_member', true); return $is_premium_member === 'yes'; }, 10, 2); add_filter('wpgens_loyalty_show_loyalty_points_content', function($show_content, $user_id) { $is_premium_member = get_user_meta($user_id, 'premium_member', true); return $is_premium_member === 'yes'; }, 10, 2); ``` --- ### Complex Points Calculation ``` add_filter('wpgens_loyalty_should_calculate_item_points', function($should_calculate, $product, $quantity) { if ($product->get_type() === 'composite') { return has_composite_parent($product) ? false : true; } if ($product->get_meta('_disable_loyalty_points') === 'yes') { return false; } if ($quantity > 10) { return false; } return $should_calculate; }, 10, 3); add_filter('wpgens_loyalty_cart_points_before_discount', function($total_points, $cart) { $max_points = 1000; if ($total_points > $max_points) { return $max_points; } $cart_total = $cart->get_total('edit'); if ($cart_total > 500) { return $total_points + 100; } return $total_points; }, 10, 2); ``` ## Common Integration Patterns ### Awarding Points for Custom Events ``` add_action('your_plugin_custom_event', function($user_id, $event_data) { $points = calculate_points_from_event($event_data); $description = sprintf('Completed %s', $event_data['event_name']); do_action( 'wpgens_loyalty_update_points', $user_id, $points, 'add', 'your_plugin', $event_data['event_id'], $description ); }); ``` --- ### Deducting Points for Penalties ``` function deduct_points_penalty($user_id, $points, $reason) { do_action( 'wpgens_loyalty_update_points', $user_id, $points, 'deduct', 'penalty', null, $reason ); } ``` This comprehensive documentation covers all available hooks and filters in the **WPGens Points and Rewards plugin**, providing you with the tools you need to extend and customize the plugin’s functionality. By leveraging these hooks and filters, you can: - Build advanced loyalty strategies, - Integrate with external CRMs or marketing tools, - Enforce custom business rules, and - Control exactly how points are calculated, awarded, and redeemed. --- ### Filtering and Managing User Points URL: https://wpgens.com/docs/loyalty-program/filtering-and-managing-user-points/ ## Filter and Adjust Member Points The Members area includes built-in filters to help you find and manage customer point data more efficiently. You can filter by: - Name or Email - Points Balance range - Points Collected or Redeemed - Search terms (e.g. partial email) To **adjust points manually**: - Find the user in **Points & Rewards > Members**. - Click the **Edit** or **Adjust Points** icon. - Enter the new point value or the number of points to add/subtract. - Optionally include a note for reference. - Click **Save**. ![WPGens Points and Rewards - Members - Adjust Points](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Members-Adjust-Points.png) These changes are logged and reflected in the member’s activity history. --- ### Frontend Display Settings URL: https://wpgens.com/docs/loyalty-program/frontend-display-settings/ This area allows you to control how points and rewards information is shown to your customers across product pages, cart, and checkout. Customizing these settings ensures a consistent brand experience and clear communication of earning/redeeming opportunities. You can find all display options under **Points & Rewards > Frontend Display** ## Points Branding Name your points currency to match your brand voice. - **Points Currency (Singular)** – e.g. *Point* - **Points Currency (Plural)** – e.g. *Points* **Examples:** - Coins / Coin - Gems / Gem - Beans / Bean - Store Credits / Store Credit ![WPGens Points and Rewards for WooCommerce - Points Branding](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-Branding.png) These names will be used wherever point amounts are displayed on your store. ## Product Page Settings Let customers see how many points they’ll earn directly on product pages. To configure: Choose how point-earning information appears on product pages. - **Show Points Earning Above Product Price** Enable this option to show how many points customers can earn directly above the product price. Applies only if the “Place Order” earning action is enabled. - **Points Earning Template** Customize the display with HTML and dynamic tags: `{{points}}` – Number of points earned - `{{points_label}}` – “Point” or “Points” (based on quantity) - `{{product_price}}` – Product price including currency symbol Example Template: **Earn {{points}} {{points_label}} for this product!** ![WPGens Points and Rewards for WooCommerce - Frontend Display - Poduct page](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Frontend-Display-Poduct-page.png) This section uses WooCommerce hooks, so placement may vary slightly by theme. ## Auto Open & Hide Redemption Form Control how the points redemption form behaves during checkout. Settings include: - **Hide Points Redemption Form on Checkout if Zero Balance**: Prevents the form from showing for users with no points. - **Auto Open Points Redemption Form**: Automatically expands the form when the checkout page loads, saving the customer a click. ![WPGens Points and Rewards for WooCommerce - Points redemption form](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-redemption-form.png) These options improve UX by keeping the interface clean and responsive to the user’s balance. ## Points Earning Box (Cart & Checkout) Show customers how many points they’ll earn for their purchase: - **Show Points Earning** – Displays before the checkout button on the cart page (for classic cart templates) and in the order review section on the checkout page. NOTE: This applies only if the “Place Order” earning action is enabled. ![WPGens Points and Rewards for WooCommerce - Points earning box](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-earning-box-1.png) The Points Earning Box is especially helpful to encourage repeat purchases by making rewards more visible. --- ### Getting Started URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/getting-started-wtih-dynamic-coupons-for-klaviyo/ [Dynamic Coupons for Klaviyo](https://wpgens.com/downloads/dynamic-coupons-for-klaviyo-for-woocommerce/) allows your WooCommerce store to automatically create, apply, and manage discount coupons directly through Klaviyo flows and segments. Additionally, you can track advanced WooCommerce events in Klaviyo and use them to create segments or automate flows, and hide coupon codes at checkout for a seamless customer experience—all without manually creating or managing coupons in WooCommerce. ## Step 1 – Install the plugin - Download the plugin **ZIP file** - In WordPress, go to ** Plugins > Add Plugin** - Click **Upload Plugin** > **Choose File** - Select the **ZIP file** from your computer - Click** Install Now** - Click **Activate** ## Step 2 – Add your licence key - In WordPress, go to **WooCommerce > Klaviyo Coupons** - Click **Automatic Updates** - Enter the **Licence Key** your received via email and click **Save** ## Step 3 – Connect with Klaviyo - Create a new **Private API key** in Klaviyo with **Full Access**. You can follow the steps in the [official Klaviyo documentation](https://help.klaviyo.com/hc/en-us/articles/7423954176283) or watch [this tutorial.](https://youtu.be/INudPz35ipE?si=pPaqk9mkXs46M4D2) - Go to: **WooCommerce > Klaviyo Coupons > Dynamic Coupons** - Enter your Klaviyo API key - Click **Validate and Save** You are now ready to use the plugin. --- ### Global Settings Overview URL: https://wpgens.com/docs/loyalty-program/global-settings-overview/ ## Configure Global Settings for Your Points Program The **General Settings** section controls the core behavior of your loyalty program and how points are calculated and applied. To access, go to **Points & Rewards > General Settings**. ## **Program Status** Toggle the entire loyalty program on or off. ![WPGens Points and Rewards for WooCommerce - Program status](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Program-status.gif) ## General Settings ### Order Status Triggers You can define **which WooCommerce order statuses will trigger point awards**. This prevents customers from earning points on unconfirmed or refunded orders. Under Award Points on Order Status, choose one or more: For example: - Select only “Completed” to award points after payment and fulfillment. - Select “Processing” if you want to reward points immediately after a successful payment. ![WPGens Points and Rewards for WooCommerce - Award points on order status](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Award-points-on-order-status.gif) ### Assigning Points to Guest Users Want to award points to guests who haven’t created an account? You can do that – as long as their **billing email matches an existing WordPress user**. How this option works: - If a customer checks out as a guest but uses an email that matches an existing user account, their order will earn points and be assigned to that user. - If no match is found, points will not be awarded. This feature helps ensure points aren’t lost for frequent customers who forget to log in. ### Exclude Sale Products from Points Calculations **Exclude Taxes from Points Calculation**: Points will only be calculated on the pre-tax subtotal. This exclusion is helpful if you want to limit rewards on already discounted purchases or comply with tax polici ### **Coupon Prefix** Customize the prefix used when generating reward coupon codes (e.g., `loyalty_abc123`). ![WPGens Points and Rewards for WooCommerce - Coupon Prefix](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Coupon-Prefix.gif) ## Points Expiration Enable expiration and set how long points are valid (in days). ![WPGens Points and Rewards for WooCommerce - Points expiration](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-expiration.png) ## **Social Profile Links** Add URLs for Facebook, Twitter, Instagram, TikTok – used for earning actions like follows or likes. You can also set up the **Register Page URL** and **Sign In Page URL** for all guest users visiting the **Points and Rewards landing page**. ![WPGens Points and Rewards for WooCommerce - Social links](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Social-links.png) Make sure your brand’s point names and expiration rules are set before launching publicly. --- ### Hide Coupons URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/hide-coupons/ You can use the **hidden coupons** feature to hide Dynamic Coupons, Segment Coupons or any coupon that matches a custom pattern. ![](https://wpgens.com/wp-content/uploads/2025/08/03.png) **To hide a coupon pattern:** - Go to **WooCommerce > Klaviyo Coupons > Hidden Coupons** - In the **Hide Coupon Pattern** section, enter a pattern to hide. For example, if you enter “KLV-*”, all coupons that start with “KLV-” will be hidden. Use * as a wildcard. - Click **Save**. All coupons matching the set pattern will now be hidden during checkout. **To hide dynamic coupons:** - Go to **WooCommerce > Klaviyo Coupons > Hidden Coupons** - Turn on **Hide Dynamic Coupons** toggle - Click **Save**. All coupons generated using the Dynamic Coupons feature will now be hidden during checkout. Important: this will hide the dynamic coupons based on the current coupon prefix configured on the Dynamic Coupons page. If you change this prefix after some dynamic coupons have already been created, the coupons with the old prefix will not be hidden. To hide them, use the Hide Coupon Pattern feature described above. **To hide segment coupons:** - Go to **WooCommerce > Klaviyo Coupons > Hidden Coupons** - Turn on **Hide Segment Coupons** toggle - Click **Save**. All coupons generated using the Segment Coupon feature will now be hidden during checkout. --- ### How Points Are Earned and Redeemed URL: https://wpgens.com/docs/loyalty-program/how-points-are-earned-and-redeemed/ The WPGens Points and Rewards for WooCommerce plugin allows store owners to define how customers **earn** and **redeem** points. You can fully customize earning actions and redemption options to fit your store’s loyalty goals. This guide explains how points are earned, how they are redeemed, and where to manage these settings in your WordPress admin. ## How Customers Earn Points Customers can earn points by performing specific actions on your site. You can configure these earning actions in **Points & Rewards → Setup** ### Common Ways to Earn Points: You can add or customize earning actions such as: - **Place Order** – Earn points for purchases (e.g., 1 point per $1 spent) - **Registration** – Reward users for creating an account - **Product Review** – Incentivize reviews with points - **Social Actions** – Follow or like on platforms like Instagram, Facebook, TikTok - **Birthday Points** – Celebrate customers by gifting points on their birthday - **[Refer a Friend](#RAF)** – Reward users who invite others to your store[*](#RAF) ### How to Add an Earning Action: - Go to **Points & Rewards → Setup** - Scroll to **Ways to Earn** - Click **Add earning action** - Choose the **Action Type** - Enter a **Title** and set the number of **Points Earned** - Enable the rule and **Save** ![WPGens Points and Rewards - Add Earning Action](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Add-Earning-Action.png) You can add as many actions as needed to align with your engagement strategy. ## How Customers Redeem Points Customers can redeem their earned points in two primary ways: ### **Redeem at Checkout (Points to Currency Conversion)** If enabled, customers can apply points as a **discount** directly at checkout. Configure this under **Points & Rewards → Setup → Points Conversion** Key settings include: - **Enable Points to Currency Conversion** - **Set a Conversion Rate** (e.g., 10 points = $1) - Define: **Minimum Points Required** to redeem - **Maximum Points Allowed** per order - Whether to include **shipping** or **exclude taxes** ### **Where does this option appear**? The redemption form is shown in the **order review section** of the checkout page. You can further control this behavior in **Frontend Display**: - Auto open the form - Hide the form if the user has 0 points ### **Redeem for Specific Rewards (Reward Actions)** You can also create **custom rewards** that customers can claim in exchange for points. These are set in the same **Setup** section under **Ways to Redeem** Examples of redemption actions: - **Fixed discount (e.g., $10 off)** - **Percentage discount (e.g., 20% off any product)** - **Free shipping** - **Free product or gift item** #### To Add a New Redemption Option: - Go to **Points & Rewards → Setup** - Scroll to **Ways to Redeem** - Click **Add redemption action** - Choose an **Action Type** (e.g., fixed discount, free product) - Set a **Title** and the **Points Cost** - Save the reward ![WPGens Points and Rewards - Add Redemption Action](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Add-Redemption-Action.png) Customers can view available rewards on the **Landing Page** or in their **My Account** section. *In order for your customers to earn points for referrals, you need to have the [**WooCommerce Refer a friend PREMIUM**](https://wpgens.com/downloads/refer-a-friend-for-woocommerce-premium/) enabled. --- ### How to Add a Loyalty Program Page in WooCommerce URL: https://wpgens.com/docs/loyalty-program/how-to-add-loyalty-program-page-woocommerce/ The `[WPGENS_LOYALTY_PAGE]` shortcode renders the full loyalty and rewards dashboard on any page or post. Place it on a dedicated loyalty page so customers can view their points balance, transaction history, referral link, rank progress, and available rewards without navigating to My Account. ### Aliases Both shortcodes render the exact same dashboard. `[WPGENS_POINTS_PAGE]` is the legacy name from the Points and Rewards plugin. `[WPGENS_LOYALTY_PAGE]` is the current preferred name used by the Loyalty Program plugin. Either works — use whichever matches your plugin. ``` [WPGENS_LOYALTY_PAGE] [WPGENS_POINTS_PAGE] ``` ## Parameters This shortcode accepts no parameters. The output is controlled entirely by your plugin settings and the current user state. ## What It Displays The shortcode automatically detects the visitor state and renders the appropriate view: Visitor StateWhat Is ShownGuest (not logged in)A guest-friendly page prompting the visitor to log in or register to join the loyalty program.Logged in, not yet enrolledThe enrollment screen if the opt-in gate is enabled in settings. Customers must join before their dashboard appears.Logged in and enrolledThe full loyalty dashboard: points balance, history, referral link, rank progress, and reward redemption options. ## How to Use It Create a new page in WordPress (for example, titled **Loyalty Program** or **My Rewards**) and add the shortcode to the page content. Then link to that page from your navigation menu, footer, or My Account page so customers can find it easily. If you are using a page builder like Elementor or Breakdance, add a Shortcode block or widget to the page layout and enter the shortcode there. ## My Account Integration The plugin also adds a **Loyalty Program** tab inside WooCommerce My Account automatically. That tab uses the same dashboard output as this shortcode. The standalone shortcode page is useful when you want the dashboard accessible outside of My Account, such as in a custom loyalty landing page, a popup, or a page builder layout. --- ### How to Earn Points URL: https://wpgens.com/docs/loyalty-program/how-to-earn-points/ With Points & Rewards for WooCommerce, you can offer points for a wide range of customer activities—like registering, writing reviews, placing orders, referring friends, or even following your brand on social media. These incentives help increase engagement and loyalty across the customer journey. ## Default Earning Actions To get started quickly, the plugin includes several **predefined actions** that you can enable or disable as needed. Each one can be customized with its own title and point value. You can find and manage these by going to: - **Points & Rewards > Setup > Ways to Earn** Here are a few common examples: Action TypeDefault PointsDescriptionPlace Order1 per $1 spentEarn points based on cart totalRegistration100Reward for creating an accountProduct Review50Earn points for leaving a product reviewFacebook Like20Points for liking your Facebook pageInstagram Follow10Reward for following on InstagramBirthday Points200Grant points on a customer’s birthdayRefer a Friend500Awarded after a successful referral ## Creating Custom Earning Actions Need something more specific? You can create your own custom actions. - Navigate to **Points & Rewards > Setup > Ways to Earn**. - Click **Add earning action**. - In the modal that appears: **Select the action type** (e.g., review, registration, refer a friend). - **Enter a title** (e.g., “Leave a Review”, “Join Our Community”). - **Set how many points will be awarded**. - **Toggle the action as Enabled or Disabled**. - Click **Save**. ![WPGens Points and Rewards for WooCommerce - Ways to earn](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Ways-to-earn.gif) Some action types (like birthdays or social follows) require that the customer has completed that action on your site or profile. Make sure social profile URLs are set under **Points & Rewards > Settings**. ## Managing Earning Actions You can edit or remove any earning action at any time. To **edit an existing action**: - Go to **Ways to Earn**, and click **Edit** next to the action you want to change. - Adjust the title, points, or status. - Save your changes. To **remove** an earning action, click the trash icon beside it. **Important Notes:** - All changes take effect immediately. - Editing a point value won’t retroactively change previously earned points. - Be consistent with point values across actions to keep the program balanced. --- ### How to Enable or Disable the Points & Rewards Program URL: https://wpgens.com/docs/loyalty-program/how-to-enable-or-disable-the-points-rewards-program/ ## Program Status and Activation To begin rewarding customers with points, you must first activate the program: - Go to **Points & Rewards > Setup**. - Under **Program Status**, toggle the switch to activate or deactivate the loyalty program. ![WPGens Points and Rewards for WooCommerce - Enable or Disable the Points & Rewards Program](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Enable-or-Disable-the-Points-Rewards-Program.gif) **When enabled:** - Points will be automatically earned based on the rules you configure. - Customers will be able to redeem rewards at checkout or through the points landing page. **When disabled:** No points will be earned or redeemed, but all settings are retained for future use. --- ### How to Enable Points Conversion at Checkout URL: https://wpgens.com/docs/loyalty-program/how-to-enable-points-conversion-at-checkout/ ## Requirements Before enabling the display, ensure that: - The **Points to Currency Conversion** option is enabled under **Points & Rewards > Setup**. - You’ve set a **Points to Currency Conversion Rate** (e.g., 10 points = $1). - Customers have a points balance in their account. ## Enabling Points Conversion at Checkout - Go to **Points & Rewards > Setup** in your WordPress dashboard. - Scroll to the **Points Conversion** section. - Enable the toggle: **Points to Currency Conversion**. - Set the **Conversion Rate**, **Minimum Points Required**, and **Maximum Points Allowed**. - Save your settings. ## Where Points Conversion is **Displayed** Under **Points & Rewards > Frontend Display**, you control **how and when** customers see their points earning/redeeming options – including **Points Conversion visibility at Checkout**. #### Key Settings in Frontend Display that affect Points Conversion: - **Points Redemption Form** **Hide Points Redemption Form on Checkout if Zero Balance** – Hides the conversion form for users with no points. - **Auto Open Points Redemption Form** – Expands the form by default on checkout page load. - **Points Earning Box** Though not directly related to conversion, this box shows how many points will be earned, encouraging point usage. Don’t forget to set a conversion rate and save your changes. --- ### How to Export Customer Points Data URL: https://wpgens.com/docs/loyalty-program/how-to-export-customer-points-data/ ## Exporting Member Points Data You can export your members’ points data to a CSV file at any time. This is useful for backups, reporting, or migrating to another system. To export: - Navigate to **Points & Rewards > Members**. - Click the **Download CSV** button at the top of the page. The file will include: - Customer email - First/Last name - Current points balance - Total collected and redeemed points --- ### How to get a user’s points using php? URL: https://wpgens.com/docs/loyalty-program/how-to-get-a-users-points-using-php/ To display a user’s points balance in your theme or plugin, you can use the following code: ``` // Get user points balance $points = WPGL_Database::get_user_points($user_id); // Example usage in a template $user_id = get_current_user_id(); $points = WPGL_Database::get_user_points($user_id); echo "Your points balance: " . $points; ``` This will return the raw points value. If you need to format it with the points label (e.g. “100 Points”), you can use: ``` $points = WPGL_Database::get_user_points($user_id); $points_label = $points == 1 ? 'Point' : 'Points'; echo $points . ' ' . $points_label; ``` **Note: Make sure to check if the user is logged in before displaying their points balance.** --- ### How to Redeem Points URL: https://wpgens.com/docs/loyalty-program/how-to-redeem-points/ Once your customers earn points, they’ll want to spend them – so it’s essential to create clear and enticing ways to redeem. With WPGens Points and Rewards for WooCommerce, you can define multiple types of rewards, from percentage discounts to free items, all backed by detailed usage rules. Redemption options are created and managed from: - **Points & Rewards > Setup > Ways to Redeem** ## Setting Up Redemption Actions To create a new reward that customers can redeem points for: - Click **Add redemption action**. - Fill in the following: **Title**: The name of the reward (e.g., “10% Off”, “Free Shipping”). - **Points Cost**: How many points are required to claim the reward. - **Enabled**: Toggle the reward on or off. After entering the basic info, you’ll see more options for customizing how the coupon works. ![](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Ways-to-redeem.gif) ## Coupon Types & Restrictions You can choose from multiple **coupon types**, each suited for a different kind of reward: - **Fixed Cart Discount** – A set discount on the entire order (e.g., $10 off). - **Percentage Discount** – A percentage off the total cart value (e.g., 10% off). - **Product Discount** – A fixed amount off specific products. - **Free Shipping** – Grant free shipping without altering product prices. You can also apply **optional restrictions**: - **Minimum Spent** – Set a required cart subtotal to apply the reward. - **Coupon Duration** – Set how long the coupon is valid (leave blank for no expiration). - **Reward-specific Coupon Prefix** – Customize the beginning of the auto-generated coupon code ## Reward Expiration, Minimum Spend & Product Rules To create more precise control over where and how rewards are used, you can apply **product and category filters**: - **Include Products** – Reward applies only if these products are in the cart. - **Exclude Products** – The coupon will not discount these products. - **Include Categories** – Coupon applies only if items from these categories are in the cart. - **Exclude Categories** – Coupon will skip any items from the selected categories. **Tip:** If you’re offering limited-time rewards, setting an expiration (in days) is a great way to encourage faster redemption and increase urgency. --- ### How to Send Birthday Emails with Brevo and Loyalty Program for WooCommerce URL: https://wpgens.com/docs/loyalty-program/brevo-birthday-email-automation-loyalty-program/ Loyalty Program for WooCommerce syncs customer birthday data to Brevo automatically. When a customer saves their birthday in their WooCommerce account, the date is pushed to their Brevo contact as the **LOYALTY_BIRTHDAY** attribute. You can then use Brevo’s automation builder to send a birthday email on the right day, every year. ## Prerequisites - Brevo integration enabled under **Loyalty Program → Settings → Integrations → Brevo** with a valid API key. - Birthday points action enabled under **Loyalty Program → Settings → Earning Points** so the birthday field appears on the customer account page. ## How Birthday Sync Works When a customer enters and saves their birthday in **My Account → Account Details**, the plugin syncs the date to their Brevo contact as the **LOYALTY_BIRTHDAY** contact attribute. The date is stored in `YYYY-MM-DD` format. No manual import is needed. ## Step 1: Create the LOYALTY_BIRTHDAY Attribute in Brevo Before the sync can store data, the attribute must exist in your Brevo account: - In Brevo, go to **Contacts → Settings → Contact Attributes**. - Click **Add a new attribute**. - Set the attribute name to `LOYALTY_BIRTHDAY`. - Set the type to **Date**. - Save the attribute. ## Step 2: Create a Birthday Automation in Brevo - In Brevo, go to **Automations** and click **Create a workflow**. - Choose **Start from scratch**. - For the entry point, select **Anniversary date** as the trigger type. - Choose the attribute **LOYALTY_BIRTHDAY** as the date field. - Set when the workflow should start relative to the date, for example **on the day of** or **1 day before**. - Add a **Send an email** step and select or create your birthday email template. - Activate the workflow. ## Tips for the Birthday Email - Use Brevo’s personalisation variables such as `{{ contact.FIRSTNAME }}` to address customers by name. - Mention the birthday points bonus they have received or will receive. - Add a CTA button linking to your loyalty program page so customers can see their updated balance. - Consider including a birthday-specific discount code to increase conversions. --- ### How to Send Birthday Emails with Klaviyo and Loyalty Program for WooCommerce URL: https://wpgens.com/docs/loyalty-program/klaviyo-birthday-email-automation-loyalty-program/ Loyalty Program for WooCommerce integrates deeply with Klaviyo. When a customer saves their birthday in their WooCommerce account, the plugin syncs it to their Klaviyo profile. When the loyalty program awards birthday points on their actual birthday, Klaviyo receives a **Points Updated** event with the source set to **Birthday bonus**. Both of these signals can be used to trigger a birthday email flow. ## Prerequisites - Klaviyo integration enabled under **Loyalty Program → Settings → Integrations → Klaviyo** with a valid API key. - Birthday points action enabled under **Loyalty Program → Settings → Earning Points** so the birthday field appears on the customer account page. ## What Gets Synced to Klaviyo The integration sends two types of data related to birthdays: - **Profile property `loyalty_birthday`** — synced the moment a customer saves their birthday in My Account. This is a date value you can use for date-based flow triggers. - **Points Updated event** — fired when birthday points are awarded by the daily cron. The event includes a `reason_title` property set to `Birthday bonus` and a `source` property, so you can filter flows specifically to birthday point awards. ## Option A: Date-Based Flow Using the Birthday Profile Property This approach sends the birthday email on or around the customer’s birthday each year, regardless of whether points have been awarded yet. It is the most reliable option for sending a birthday email in advance. - In Klaviyo, go to **Flows** and click **Create Flow**. - Choose **Create from Scratch**. - For the trigger, select **Date Property**. - Choose the profile property **loyalty_birthday**. - Set the timing to **0 days after** (on the birthday) or a negative value to send in advance, such as **1 day before**. - Add an **Email** action and design your birthday email. Personalise it with the `{{ person.first_name }}` variable and include a link to the customer’s loyalty page. - Set the flow to **Live**. ## Option B: Event-Based Flow Triggered by Birthday Points This approach triggers the email exactly when the birthday points are awarded, which confirms the customer has received their bonus. - In Klaviyo, go to **Flows** and click **Create Flow**. - For the trigger, select **Metric** and choose **Points Updated**. - Add a **Trigger Split** immediately after the trigger. - Set the condition to: `reason_title` equals `Birthday bonus`. This ensures the flow only continues for birthday point awards, not every points update. - On the **Yes** branch, add your **Email** action with the birthday email. - Set the flow to **Live**. ## Tips for the Birthday Email - Use `{{ person.first_name }}` to personalise the greeting. - Mention the exact number of birthday points awarded using the `{{ event.delta }}` variable (available in event-based flows). - Include a CTA button linking to the loyalty program page where they can see their updated balance and redeem points. - Consider pairing with a limited-time birthday discount coupon to increase conversions. --- ### How to Send Birthday Emails with Mailchimp and Loyalty Program for WooCommerce URL: https://wpgens.com/docs/loyalty-program/mailchimp-birthday-email-automation-loyalty-program/ Loyalty Program for WooCommerce automatically awards points to customers on their birthday. With the Mailchimp integration, the customer’s birthday is also synced to their Mailchimp profile the moment they save it in their account — so you can build a birthday email automation in Mailchimp that fires on the right day, every year. ## Prerequisites - Mailchimp integration enabled under **Loyalty Program → Settings → Integrations → Mailchimp** with a valid API key and Audience (List) ID. - Birthday points action enabled under **Loyalty Program → Settings → Earning Points** — this activates the birthday field on the customer account page. - A Mailchimp account with a Standard or Premium plan (required for Customer Journeys). ## How Birthday Sync Works When a customer enters and saves their birthday on the WooCommerce **My Account → Account Details** page, the plugin immediately syncs that date to their Mailchimp contact as the **BIRTHDAY** merge field (in `MM/DD` format, which is the format Mailchimp’s native birthday field expects). No manual export or import is needed — it happens automatically in the background. ## Step 1: Add a BIRTHDAY Merge Field to Your Mailchimp Audience Mailchimp needs a birthday merge field in your audience before it can store the synced date. To check or add it: - In Mailchimp, go to **Audience → Manage Audience → Settings**. - Click **Audience fields and *|MERGE|* tags**. - Look for a field with the tag `BIRTHDAY`. If it already exists, you are done with this step. - If it does not exist, click **Add A Field**, choose **Birthday** as the field type, and set the merge tag to `BIRTHDAY`. - Save changes. ## Step 2: Have Customers Save Their Birthday Customers enter their birthday on the **My Account → Account Details** page. The birthday field appears automatically once the birthday points action is enabled in the plugin settings. As soon as a customer saves their birthday, it is pushed to Mailchimp and the `BIRTHDAY` merge field on their contact profile is updated. You can encourage customers to add their birthday by mentioning the birthday points bonus in your loyalty program page or in a welcome email. ## Step 3: Create a Birthday Customer Journey in Mailchimp Once birthdays are syncing to Mailchimp, set up an automated birthday email: - In Mailchimp, go to **Automations → Customer Journeys** and click **Create Journey**. - Give the journey a name (e.g. “Birthday Email”) and select your audience. - For the starting point, choose **Date-based** as the trigger type. - Select **Contact’s birthday** (or select the **BIRTHDAY** merge field if “Contact’s birthday” is not listed as a preset). - Set the timing — for example, **On the day** or **1 day before** the birthday date. - Add a **Send Email** action and design your birthday email. A typical birthday email includes: A personalised greeting using the `*|FNAME|*` merge tag - A reminder that birthday points have been awarded to their account - A CTA button linking to your loyalty program page - An optional exclusive birthday discount code - Activate the journey. ## What the Customer Receives On (or around) their birthday, the customer receives your email automatically. At the same time, the loyalty plugin’s daily cron awards them their birthday points. The two processes are independent — the plugin handles the points, Mailchimp handles the email — so both happen reliably without any additional configuration. --- ### How to Send Birthday Emails with Omnisend and Loyalty Program for WooCommerce URL: https://wpgens.com/docs/loyalty-program/omnisend-birthday-email-automation-loyalty-program/ Loyalty Program for WooCommerce syncs customer birthday data to Omnisend automatically. When a customer saves their birthday in their WooCommerce account, the date is pushed to their Omnisend contact as the **loyaltyBirthday** custom property. You can then use Omnisend’s automation builder to send a birthday email that fires every year on the right date. ## Prerequisites - Omnisend integration enabled under **Loyalty Program → Settings → Integrations → Omnisend** with a valid API key. - Birthday points action enabled under **Loyalty Program → Settings → Earning Points** so the birthday field appears on the customer account page. ## How Birthday Sync Works When a customer enters and saves their birthday in **My Account → Account Details**, the plugin syncs the date to their Omnisend contact as the **loyaltyBirthday** custom property. The date is stored in `YYYY-MM-DD` format. No manual import is needed. ## Step 1: Confirm the Custom Property in Omnisend Omnisend creates custom properties automatically the first time a value is sent via the API, so no manual setup is required. After a customer saves their birthday, you can verify the property exists by opening any synced contact in Omnisend and checking their custom properties for `loyaltyBirthday`. ## Step 2: Create a Birthday Automation in Omnisend - In Omnisend, go to **Automation** and click **New Workflow**. - Choose **Custom Trigger** or start from the **Date-based** template if available. - Set the trigger to fire based on a **Contact date property**. - Select **loyaltyBirthday** as the property. - Set the timing, for example **on the day of** or **1 day before**, and set it to repeat **yearly**. - Add an **Email** block and design your birthday message. - Activate the workflow. ## Tips for the Birthday Email - Use Omnisend’s personalisation tags such as `{{contact.firstName}}` to greet customers by name. - Mention their birthday points bonus and link to your loyalty program page so they can see their updated balance. - A birthday-specific discount code alongside the points notification is a strong combination for driving a purchase on the customer’s birthday. --- ### How to Set Up Points Expiration URL: https://wpgens.com/docs/loyalty-program/how-to-set-up-points-expiration/ ## Enabling Point Expiry Point expiration helps keep your loyalty program active by encouraging customers to redeem points before they lose them. This can also reduce long-term reward liabilities. To enable point expiration: - Go to **Points & Rewards > Settings** - Scroll to the **Points Expiration** section. - Toggle the switch to **Enable Points Expiration**. - Save your settings. Once enabled, all newly earned points will have an expiration timer based on the period you set (see next doc). Customers will also be notified via email – if you’ve configured the Points Expiry Warning Email. ![WPGens Points and Rewards for WooCommerce - Points expiration](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-expiration-1024x393.png) Point expiration only applies to points earned **after** the setting is enabled. ## Choose How Long Points Stay Valid After enabling expiration, you’ll need to define the **expiration period**—how long points should remain valid before expiring. To set it: - Go to **Points & Rewards > Settings** - In the **Points Expiration** section, use the dropdown to choose one of the available options: **30 Days** - **60 Days** - **90 Days** - **180 Days** - **365 Days** - Save your changes. Once enabled, points will expire after the selected number of days from the date they were earned. Leaving the expiration field blank will disable the countdown (even if expiration is enabled). Point expiration is tracked per transaction, so the oldest points expire first. ## Best Practices for Managing Expired Points While point expiration is a great way to drive urgency, it’s important to handle it in a way that protects the customer experience. Here’s how you can handle points expiration. ### 1. **Enable Expiry Warnings** - Go to **Points & Rewards > Emails**. - Configure the **Points Expiry Warning Email**. - Use clear subject lines and include: Points balance - Expiration date - Link to the the Points and Rewards page This helps avoid surprise expirations and gives customers time to act. ### 2. **Choose a Reasonable Expiry Windo**w - Avoid too-short durations like 30 or 60 days unless running a special promotion. - A typical expiry period is **180–365 days**. - This gives customers time to accumulate and redeem meaningfully. ### 3. **Communicate Expiry Clearly** - Mention expiration timelines in your points program description (e.g., in the landing page or FAQ). - Show expiration dates on user dashboards if feasible. ### 4. **Consider a Grace Period for Support** - If customers miss a deadline by a day or two, consider restoring expired points manually as a goodwill gesture. Point expiration should feel like a gentle nudge – not a punishment. The goal is to keep your program active, rewarding, and fair. --- ### How to Set up Social Links URL: https://wpgens.com/docs/loyalty-program/how-to-set-up-social-links/ ## Adding Social Media Links for Rewards This area allows you to define custom links for key actions and features related to your Points and Rewards program. These URLs are used in emails, buttons, referral links, and landing pages – making them essential for a seamless user experience. Properly setting these ensures customers are directed to the correct pages for signing in, registering, reviewing products, or performing social actions that can earn them points. To set this up: - Go to **Points & Rewards > Settings** - Scroll to the **Social Links** section. - Add URLs for the platforms you’re using: Facebook Page – Links to your brand’s Facebook page (used when customers earn points for liking) - Twitter Page – Links to your brand’s Twitter/X profile - Instagram Page – Links to your brand’s Instagram profile - TikTok Page – Link to your TikTok profile - Place Order Page – Optional URL to direct users back to the shop or a custom page for placing orders - Product Review Page – Directs users to leave product reviews (earning action must be enabled) - Register Page URL – to your site’s user registration page - Sign In Page URL – to the login/sign-in page - Save your settings. ![WPGens Points and Rewards for WooCommerce - Social links](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Social-links.png) These URLs are used dynamically in emails, landing pages, and referral flows. Make sure they are always accurate and point to live, public-facing pages. --- ### How to View Member Points, Activity Logs & Import Points URL: https://wpgens.com/docs/loyalty-program/how-to-view-member-points-activity-logs-import-points/ ## Viewing Member Points & History The Members section gives you a full overview of every customer’s point balance, along with total collected and redeemed points. You can also dig into individual histories to understand how points were earned, spent, or expired. The **Members** section gives you a full overview of every customer’s point balance, along with total collected and redeemed points. You can also dig into individual histories to understand how points were earned, spent, or expired. To access: - Go to **Points & Rewards > Members**. - Use the search or filters to find a customer by: First Name - Last Name - Email - Review the columns: **Points Balance** - **Points Collected** - **Points Redeemed** - Click on a member’s name or use the action icons to view detailed logs of their point transactions. Each log entry includes: - Date - Action (e.g. order, social follow, manual import) - Points added or subtracted ![](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Dashboard-Points-activity-type.gif) ## How to Import Points Using a CSV File Need to award points in bulk or migrate from another system? You can import points for multiple users using a simple CSV upload. Here’s what you need to do: - Go to **Points & Rewards > Members**. - Click **Import Points** (top-right corner). - Upload a CSV file using this format: `email,points` Example: `customer@example.com,150` - Choose an **Import Mode**: **Add to existing points** - **Replace existing points** - Click **Import** to apply changes. You can also download a sample CSV to make sure your format is correct. ![WPGens Points and Rewards - Members - Import Points](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Members-Import-Points.png) 💡 **Tip:** Points will only be imported for users with matching email addresses in your WordPress user database. --- ### Import or migrate points from WooCommerce Points & Rewards URL: https://wpgens.com/docs/loyalty-program/import-or-migrate-points-from-woocommerce-points-rewards/ Importing points from WooCommerce Points & Rewards is easy via a dedicated tool. To import points: - Go to WooCommerce > Status > Tools - Find the tool called “**Migrate WooCommerce Points & Rewards to WPGens Points and Rewards**“. Note that this tool shows up only if you have WooCommerce Points & Rewards plugin installed and activated. - Click Start Migration and follow the steps on the screen - Deactivate WooCommerce Points & Rewards plugin when finished ![](https://wpgens.com/wp-content/uploads/2025/07/image-4-1024x543.png) --- ### Installing & Quick Setup URL: https://wpgens.com/docs/loyalty-program/points-and-rewards-installing-quick-setup/ To install WPGens Points and Rewards for WooCommerce, follow these steps: #### 1. Downloading the plugin - Go to [**WPGens.com** > **My Account** > **Purchase History**](https://wpgens.com/checkout/purchase-history/). - Click **View Details** next to your purchase. - At the bottom, click the **Download** link to save the plugin (.zip file) to your laptop/computer. #### 2. Uploading and installing the plugin - Go to your WordPress dashboard: **WordPress Admin** > **Plugins** > **Add New**. - Click **Upload Plugin** at the top. - Click **Choose File**, select the **.zip file** you downloaded, and click **Install Now**. #### 3. Activating the plugin - Once installed, click **Activate Plugin**. - The plugin is now active and ready to configure. Once activated, a new menu item called Points & Rewards will appear in your WordPress admin sidebar. From here, you can set up your loyalty program, customize rewards, view member data, and much more. --- ### Integrate Brevo with Points & Rewards for WooCommerce URL: https://wpgens.com/docs/loyalty-program/integrate-brevo-with-points-rewards-for-woocommerce/ ## Overview This integration allows you to automatically sync customer loyalty points data with Brevo. Once connected, the plugin pushes each customer’s points balance and last update date to Brevo as custom contact attributes. You can then use this data in Brevo to segment customers, personalize email campaigns, and trigger automated flows. ## Use cases and benefits - Send targeted campaigns to your most loyal customers - Create dynamic segments based on loyalty point tiers - Automate re-engagement campaigns when points are about to expire - Track loyalty activity across your marketing funnel ## Setup instructions ### Prerequisites This integration requires an active [Brevo](https://www.brevo.com/) account. Please make sure you are logged into your Brevo account before proceding. ### Step 1 – Enable Brevo integration - In your WordPress dashboard, go to **Points and Rewards > Settings** - Scroll down to the **Brevo Integration** section - Toggle the **Enable Integration** option ![Points & Rewards for WooCommerce - enable brevo integration](https://wpgens.com/wp-content/uploads/2025/06/Points-Rewards-for-WooCommerce-enable-brevo-integration-1024x230.png) ### Step 2 – Create required contact attributes In order for syncing to work, you’ll need to manually create two custom contact attributes in your Brevo account. To create them, go to **Contacts > Settings > Contact Attributes**, or follow this link [https://my.brevo.com/lists/add-attributes](https://my.brevo.com/lists/add-attributes). ``` • LOYALTY_POINTS_BALANCE (Number) • LOYALTY_POINTS_LAST_UPDATED (Date) ``` ![Points & Rewards for WooCommerce - Contact Attributes](https://wpgens.com/wp-content/uploads/2025/06/Points-Rewards-for-WooCommerce-Contact-Attributes.png) ### Step 3 – Add your Brevo API key To enable and retrieve API access for Brevo, follow these steps: - In the top-right corner, click your **profile name** and go to **SMTP & API** - Under the **API Keys** section, you’ll see a list of your keys (if any). Click **“+ Generate a new API key”** - Give your API key a name (e.g. *WooCommerce Points Sync*) and click **Generate** - **Copy and save the API key** – this is the key you’ll paste into the plugin settings. Please refer to the screenshots below to follow these steps. **Step 1** ![](https://wpgens.com/wp-content/uploads/2025/06/image-8-1024x608.png) **Step 2** ![](https://wpgens.com/wp-content/uploads/2025/06/image-9-1024x425.png) **Step 3** ![](https://wpgens.com/wp-content/uploads/2025/06/image-10-1024x430.png) **Step 4** ![](https://wpgens.com/wp-content/uploads/2025/06/image-11-1024x413.png) Once you generate your API key, it will appear as active. However, you won’t be able to copy it again, so make sure to save it somewhere secure before closing the window. ![Points & Rewards for WooCommerce - Brevo API key Attributes](https://wpgens.com/wp-content/uploads/2025/06/Points-Rewards-for-WooCommerce-Brevo-API-key-Attributes-1024x254.png) ### Step 4 – Paste & Connect - In the plugin integration settings, paste the API key from the previous step - Click **Save Settings** to connect the plugin to Brevo If successfull, you should see a green banner showing the plugin is connected to Judge.me ![Points & Rewards for WooCommerce - Brevo Integration API Key](https://wpgens.com/wp-content/uploads/2025/06/Points-Rewards-for-WooCommerce-Brevo-Integration-API-Key.png) The integration will now begin syncing data automatically. ## How the integration works Once connected, the plugin will automatically sync the following data to Brevo as contact attributes: - LOYALTY_POINTS_BALANCE – The customer’s current point total - LOYALTY_POINTS_LAST_UPDATED – The last time their point balance changed Data is synced in real-time when points are: - Earned from purchases - Earned from reviews or social shares - Manually adjusted by admin - Redeemed for rewards ## Common issues & solutions ### **Points data not syncing?** Make sure the two required attributes (LOYALTY_POINTS_BALANCE and LOYALTY_POINTS_LAST_UPDATED) exist in Brevo and have the correct types. ### **API Key error?** Double-check that your Brevo API key is valid and active. You can regenerate it from your Brevo dashboard under **SMTP & API**. ### **Sync delays?** While sync is real-time, delays may occur due to server caching or queueing. Try refreshing the contact in Brevo after making changes. --- ### Integrate Judge.me with Points & Rewards for WooCommerce URL: https://wpgens.com/docs/loyalty-program/integrate-judge-me-with-points-rewards-for-woocommerce/ ## Overview [WPGens Points & Rewards for WooCommerce](https://wpgens.com/downloads/points-and-rewards-for-woocommerce/) lets you reward customers for leaving product reviews through Judge.me. This integration helps increase review volume and engagement while protecting your program from duplicate or deleted reviews. - Rewarding customers for new product reviews - No points for duplicate reviews - Deducting points for deleted reviews ## Use cases and benefits - Reward customers with loyalty points when they submit new product reviews, encouraging repeat purchases. - Prevent point farming by ensuring duplicate reviews don’t earn additional rewards. - Automatically deduct points if a review is deleted, keeping your rewards program fair and accurate ## Setup instructions ### Prerequisites This integration requires the official [Judge.me plugin](https://wordpress.org/plugins/judgeme-product-reviews-woocommerce/) for WooCommerce. Please make sure you install and configure the plugin and** log into your Judge.me account before proceding.** Navigate to** Integrations > Judge.me **and toggle the integration switch. ### Step 1 – Enable Judge.me integration ![](https://wpgens.com/wp-content/uploads/2025/06/image-1024x448.png) ### Step 2 – Create a Judge.me App - Make sure you are logged into your Judge.me account. - Go to [https://judge.me/reviews/profile/apps/new](https://judge.me/reviews/profile/apps/new) and create a new app. - Enter the following information: **App Name:** Your store name (e.g., “My Store Loyalty”) - **Redirect URI:** ` https://example.com/wp-json/wpgens/v1/judgeme-oauth-callback` **Important:** replace `https://example.com` above with your website url. - Click Create: ![](https://wpgens.com/wp-content/uploads/2025/06/image-1-1024x399.png) ### Step 3 – Find the App Client ID & Secret If the steps above were successful, you will be taken to Judge.me profile page. From this page: - Click My Apps in the top right corner - Click the pencil next to the app name you created - Copy the Client ID and Secret Please refer to the screenshots below for these steps. ![](https://wpgens.com/wp-content/uploads/2025/06/image-2-1024x629.png) ![](https://wpgens.com/wp-content/uploads/2025/06/image-3-1024x633.png) ![](https://wpgens.com/wp-content/uploads/2025/06/image-4-1024x570.png) ### Step 4 – Paste & Connect - In the plugin integration settings, paste the Client ID & Secret from the previous step - Click **Connect** to connect the plugin to Judge.me - You will be redirected to Judge.me to confirm the connection If successfull, you should see a green banner showing the plugin is connected to Judge.me ![](https://wpgens.com/wp-content/uploads/2025/06/image-6-1024x456.png) ## How the integration works This integration will award customers with points for leaving product reviews using Judge.me plugin for WooCommerce. Here is how it works: - To earn points, you must have the “Product Review” [earning action](https://wpgens.com/docs/how-points-are-earned-and-redeemed/) configured - When a customer leaves a review using Judge.me, points will be awarded per earning action configuration - Points will be awarded only once per product review. Multiple reviews of the same product will not earn points. - If a customer deletes their review, any points previously earned will be deducated - You can track the points earning activity in the plugin dashboard (see below) ![](https://wpgens.com/wp-content/uploads/2025/06/image-7-1024x513.png) ## Common issues & solutions **I’m getting an error 500 on Judge.me when I try to create my application** Make sure you are logged into your Judge.me account before visiting the link to the application creation form. **I’m getting a connection error when I click “Connect”** Please carefully review your Client ID and Secret. Most issues come from copy/paste errors. **Some customers are not getting points** Make sure the customers are using the same email for Judge.me reviews as the email linked to their WordPress account. Entering a different email into Judge.me review widget will likely result in no points given. --- ### Integrate Klaviyo with Points & Rewards for WooCommerce URL: https://wpgens.com/docs/loyalty-program/klaviyo-integration/ If you use **Klaviyo** for your email marketing, the Points & Rewards plugin makes it easy to sync loyalty data so you can personalize your campaigns based on points activity. With this integration, you can: - Sync point balances and updates to Klaviyo - Create customer segments based on loyalty behavior - Trigger automated flows like expiry warnings or VIP offers ### Klaviyo Integration Setup To enable the integration: - Go to **Points & Rewards > Integrations** - Enable the **Klaviyo** toggle - Enter your **Klaviyo Private API Key** You can find this in your Klaviyo dashboard under **Account > Settings > API Keys** - Save your settings ![WPGens Points and Rewards for WooCommerce - Klaviyo Integration](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Klaviyo-Integration.gif) Once connected, the plugin will begin syncing loyalty data to Klaviyo in real-time. ### Syncing Points to Klaviyo When the integration is active, the following customer data is synced automatically as **custom properties** in Klaviyo: - **Loyalty Points Balance** – current points total `Property name: Loyalty Points Balance` - **Loyalty Points Last Updated** – the date of the most recent points activity `Property name: Loyalty Points Last Updated` This sync occurs whenever: - A customer earns points (from orders or actions) - An admin manually updates their points - A customer redeems a reward These fields are tied to the customer’s email address, so it’s important that customers check out using the same email used in their Klaviyo profile. --- ### Integrate Mailchimp with Points & Rewards for WooCommerce URL: https://wpgens.com/docs/loyalty-program/integrate-mailchimp-with-points-rewards-for-woocommerce/ ## Overview This integration allows you to automatically sync customer loyalty points data with your Mailchimp audience. Once enabled, the plugin pushes each customer’s points balance and last updated date to Mailchimp as merge fields. You can then use this data to create customer segments, send personalized campaigns, and build automations based on loyalty activity. ## Use cases and benefits - Create point-based customer segments - Send personalized emails to loyal customers - Run re-engagement flows when points are about to expire - Reward top customers with exclusive offers ## Setup instructions ### Prerequisites This integration requires an active **[Mailchimp](https://mailchimp.com/) account**. Please make sure you are logged into your Mailchimp account before proceeding. - API access to your Mailchimp account - The correct **Audience List ID** where customer data should be synced - The latest version of the Points and Rewards for WooCommerce plugin ### Step 1 – Enable Mailchimp integration - In your WordPress dashboard, go to **Points and Rewards > Settings** - Find the **Mailchimp Integration** section - Toggle the **Enable Integration** option ![Points & Rewards for WooCommerce - Mailchimp Integration](https://wpgens.com/wp-content/uploads/2025/06/Points-Rewards-for-WooCommerce-Mailchimp-Integration.png) ### Step 2 – Create required merge fields in Mailchimp In your Mailchimp audience, add the following merge fields: - LOYALTYPTS (Number) – to store the customer’s current points - PTSUPDATE (Date) – to track the last update date of their points To do this: - Go to **Audience > More Options > Audience Settings > Audience fields and merge tags** - Click **Create a new field** and select: *Number* field for LOYALTYPTS - *Date* field for PTSUPDATE - Set their tags to match exactly: LOYALTYPTS and PTSUPDATE - In the column **Default merge tag value**, enter a fallback value, such as: 0 for points balance (LOYALTYPTS) - Not yet earned or a blank date like — for PTSUPDATE - Click **Save** Please refer to the screenshots below to follow these steps. **Step 1** ![](https://wpgens.com/wp-content/uploads/2025/06/image-12-1024x507.png) **Step 2** ![](https://wpgens.com/wp-content/uploads/2025/06/image-13-1024x473.png) **Step 3** ![](https://wpgens.com/wp-content/uploads/2025/06/image-14-1024x508.png) **Step 4** ![](https://wpgens.com/wp-content/uploads/2025/06/image-22-1024x540.png) ### Step 3 – Add API key - **Log in** to your **[Mailchimp](https://mailchimp.com/) account** - In the top-right corner, click your **profile icon** **>** then click **Account & billing** - In the account menu, go to **Extras > API keys** - Scroll down to the **API keys** section If you already have an API key, you can use it - Otherwise, click **Create A Key** - **Copy the generated API key** It will look something like: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-us20 Paste this key into the **Mailchimp API Key** field under the Mailchimp Integration in Points & Rewards for WooCommerce plugin. Keep your API key secure. It grants full access to your Mailchimp account. Please refer to the screenshots below to follow these steps. **Step 1** ![](https://wpgens.com/wp-content/uploads/2025/06/image-15-1024x427.png) **Step 2** ![](https://wpgens.com/wp-content/uploads/2025/06/image-16-1024x511.png) **Step 3** ![](https://wpgens.com/wp-content/uploads/2025/06/image-17-1024x545.png) **Step 4** ![](https://wpgens.com/wp-content/uploads/2025/06/image-18-1024x505.png) **Step 5** ![](https://wpgens.com/wp-content/uploads/2025/06/image-19-1024x401.png) ### Step 4 – Add Audience ID - **Log in **to your** [Mailchimp account](https://mailchimp.com/)** - In the left sidebar, click **Audience** If you have more than one audience, click **Current audience** (top-left dropdown) and select the one you want to use. - Click on** More Options > Audience Settings** - On this page, you’ll find the **Audience ID** (also called *List ID*) as the last option of the first section. It looks like: *Audience ID: a1b2c3d4e5* - Paste this key into the **Mailchimp List ID** field under the Mailchimp Integration in Points & Rewards for WooCommerce plugin. Please refer to the screenshots below to follow these steps. **Step 1** ![](https://wpgens.com/wp-content/uploads/2025/06/image-12-1024x507.png) **Step 2** ![](https://wpgens.com/wp-content/uploads/2025/06/image-20-1024x462.png) ## How the integration works Once enabled and connected, the plugin automatically syncs the following customer data to Mailchimp as merge fields: - **LOYALTYPTS** – Current points balance - **PTSUPDATE** – Date the points were last updated Data is synced in real-time when points are: - Earned from purchases - Earned from reviews or social shares - Manually adjusted by the admin - Redeemed for rewards ## Common issues & solutions ### Merge fields not found? Check that both LOYALTYPTS and PTSUPDATE merge fields exist in your Mailchimp audience and match the tag names exactly. ### API key or audience ID not working? – Double-check your Mailchimp API key under **Account & Billing > Extras > API keys** – Get your Audience List ID from **Audience > More Options > Audience Settings > Audience name and defaults** ### No data syncing? – Ensure the test customer has earned or used points – Confirm the customer exists in the Mailchimp audience with a matching email --- ### Integrate Omnisend with Points & Rewards for WooCommerce URL: https://wpgens.com/docs/loyalty-program/integrate-omnisend-with-points-rewards-for-woocommerce/ ## Overview This integration allows you to automatically sync customer loyalty points data with Omnisend. Once connected, your store will push each customer’s points balance and the date it was last updated into Omnisend as custom properties. You can then use this data to personalize emails, build customer segments, and trigger loyalty-based automations. ## Use cases and benefits - Segment customers based on point thresholds (e.g. VIP customers) - Send automated reminders when points are close to expiring - Trigger loyalty-based email flows without manual work - Reward your most engaged customers with special offers ## Setup instructions ### Prerequisites This integration requires an active **[Omnisend](https://mailchimp.com/) account**. Please make sure you are logged into your Omnisend account before proceeding. - API key access to you Omnisend account - The latest version of Points & Rewards for WooCommerce plugin --- ### Step 1 – Enable Omnisend integration - In your WordPress dashboard, go to **Points and Rewards > Settings** - Find the **Omnisend Integration** section - Toggle the **Enable Integration** option ![Points & Rewards for WooCommerce - Omnisend Integration](https://wpgens.com/wp-content/uploads/2025/07/image-1024x282.png) --- ### Step 2 – Add your Omnisend API key - **Log in** to your **Omnisend account** - Go to **Store Settings > API Keys** - Click **Create API Key** and give it a name (e.g. “WooCommerce Points Sync”) Select API key permissions you would like to set up with the API key, the click the **Create API Key **button in the bottom right corner - Copy the key and paste it into the **Omnisend API Key** field in the plugin settings - Click **Save Settings** **Step 1** ![Points & Rewards for WooCommerce - Omnisend Store Settings](https://wpgens.com/wp-content/uploads/2025/07/Points-Rewards-for-WooCommerce-Omnised-Store-Settings-1024x711.jpg) --- **Step 2** ![Points & Rewards for WooCommerce - Omnisend API Key Permissions](https://wpgens.com/wp-content/uploads/2025/07/image-1-1024x582.png) **Step 3** ![Points & Rewards for WooCommerce - Omnisend - API Key](https://wpgens.com/wp-content/uploads/2025/07/Points-Rewards-for-WooCommerce-Omnisend-API-Key-1-1024x438.jpg) **Step 4** ![Points & Rewards for WooCommerce - Omnisend - Save API Key Settings](https://wpgens.com/wp-content/uploads/2025/07/Points-Rewards-for-WooCommerce-Omnisend-Save-API-Key-Settings-1024x403.jpg) ## How the integration works When enabled, the plugin automatically syncs customer points data to Omnisend as custom properties. The following data is synced: - **LOYALTY_POINTS_BALANCE** – Current points balance - **LOYALTY_POINTS_LAST_UPDATED** – Last update date of the points Data is synced in real-time whenever points are: - Earned from purchases - Earned from activities (e.g. reviews, social shares) - Manually adjusted by the admin - Redeemed for rewards You can use this data in Omnisend to: - Create segments based on points balance - Send targeted emails to reward high-value customers - Trigger automated flows when points are about to expire --- ## Common issues & solutions ### **Points not showing in Omnisend?** Make sure your API key is correct and the customer exists in Omnisend with a matching email address. ### **Properties missing?** Omnisend creates custom properties dynamically when data is first pushed. If you don’t see them yet, try syncing a customer who has earned or redeemed points. ### **Automation not triggering?** Ensure your automation is set to trigger based on **custom properties**, and test with a customer who has recent point activity. --- ### Klaviyo Integration: Events and Profile Properties Reference URL: https://wpgens.com/docs/loyalty-program/klaviyo-events-profile-properties-loyalty-program/ The Klaviyo integration syncs two types of data: **profile properties** that are updated on every interaction, and **events** that represent specific customer actions. Both can be used in Klaviyo flows to send targeted, personalised emails based on exactly what a customer did in the loyalty program. ## Profile Properties Profile properties are set directly on the Klaviyo contact record and update automatically whenever the corresponding data changes in the loyalty program. ### Points Properties (updated on every points transaction) PropertyTypeDescription`loyalty_points_balance`IntegerThe customer’s current points total after the transaction.`loyalty_points_last_updated`ISO 8601 datetimeTimestamp of the most recent points change.`loyalty_points_expires_at`ISO 8601 datetimeEstimated expiry date of the current points balance. Only present if points expiry is enabled.`loyalty_referral_code`StringThe customer’s unique referral code. Only present if the referral module is active. ### Birthday Property (synced when customer saves birthday) PropertyTypeDescription`loyalty_birthday`Date (YYYY-MM-DD)The customer’s birthday as entered in My Account. Use this as the trigger date for a Klaviyo birthday flow. ### Rank Properties (synced when customer achieves a rank) PropertyTypeDescription`loyalty_rank_id`IntegerThe ID of the customer’s current rank.`loyalty_rank_name`StringDisplay name of the current rank (e.g. Gold, VIP).`loyalty_rank_slug`StringURL-safe slug of the current rank.`loyalty_rank_milestone`IntegerThe points threshold required to reach this rank.`loyalty_rank_last_updated`ISO 8601 datetimeTimestamp of the most recent rank change. ## Events ### Points Updated Fired on every points transaction: earning, spending, expiring, and manual adjustments. This is the most versatile event in the integration because it covers every loyalty activity through a single `reason_title` property. PropertyTypeDescription`delta`IntegerPoints change. Positive for earned points, negative for spent or expired.`balance_after`IntegerPoints balance after the transaction.`reason_title`StringHuman-readable reason for the change. See the full list below.`source`StringMachine-readable source type.`awarded_at`ISO 8601 datetimeTimestamp of the transaction.`expires_at`ISO 8601 datetimeEstimated expiry of the current balance. Only present if points expiry is enabled. **All possible `reason_title` values:** reason_titleWhen it firesOrder purchaseCustomer earns points for placing an order.Order discountCustomer redeems points for a discount on an order.Order cancelledPoints are reversed when an order is cancelled.Order refundedPoints are reversed when an order is refunded.Product reviewCustomer earns points for leaving a product review.Friend referralCustomer earns points for referring a friend.Manual adjustmentAn admin manually adds or removes points.Registration bonusCustomer earns points for creating an account.Birthday bonusPoints awarded on the customer’s birthday.Imported pointsPoints added via CSV import.Points expiredPoints removed due to inactivity expiry. ### Rank Achieved Fired when a customer reaches a new rank tier. PropertyTypeDescription`rank_id`IntegerID of the new rank.`rank_name`StringDisplay name of the new rank.`rank_slug`StringSlug of the new rank.`rank_milestone`IntegerPoints threshold for the new rank.`previous_rank_id`IntegerID of the previous rank. Not present on first rank.`previous_rank_name`StringName of the previous rank. Not present on first rank.`achieved_at`ISO 8601 datetimeTimestamp when the rank was achieved.`coupon_code`StringThe coupon code issued as a rank reward. Only present when a coupon is configured for this rank.`coupon_codes`ArrayAll coupon codes issued when the rank has multiple rewards configured. Only present when more than one coupon is issued. ## Using Events in Klaviyo Flows In Klaviyo, create a flow with a **Metric** trigger and select **Points Updated** or **Rank Achieved**. To target a specific activity, add a **Trigger Split** immediately after the trigger and filter by `reason_title`. For example, set `reason_title = Birthday bonus` to build a birthday points confirmation flow, or `reason_title = Friend referral` for a referral congratulations email. --- ### Landing Page Customization URL: https://wpgens.com/docs/loyalty-program/landing-page-customization/ ## Points Page Customization & Shortcode To customize the layout and branding: - Go to **Display Settings > Landing Page** - Configure: **Primary Color**: Used for tabs, icons, buttons - **Title**: Main heading of the points page - **Subtitle**: A short description below the heading ![WPGens Points and Rewards for WooCommerce - Points page customization](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-page-customization.png) **This page includes the following tabs:** - Earn Points - Redeem Points - My Points (history) - My Rewards (claimed coupons) ![WPGens Points and Rewards for WooCommerce - Landing page](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Landing-page.gif) Add the shortcode to any page (or use it in your account tab) to give users a full loyalty overview. ``` [WPGENS_POINTS_PAGE] ``` --- ### Mailchimp Integration: Events and Merge Fields Reference URL: https://wpgens.com/docs/loyalty-program/mailchimp-events-merge-fields-loyalty-program/ The Mailchimp integration keeps your audience contacts in sync with loyalty data through **merge fields** (always-on profile data) and **member events** (fired when specific actions happen). Both can be used in Mailchimp Customer Journeys to trigger targeted email automations. ## Merge Fields Merge fields are updated on the Mailchimp contact record automatically whenever the corresponding data changes. You need to create these fields in your Mailchimp audience before they can store data. Go to **Audience → Manage Audience → Settings → Audience fields and *|MERGE|* tags** to add them. Merge TagTypeWhen UpdatedDescription`LOYALTYPTS`NumberEvery points transactionThe customer’s current points balance.`PTSUPDATE`TextEvery points transactionTimestamp of the most recent points change (MySQL datetime format).`BIRTHDAY`BirthdayWhen customer saves their birthdayThe customer’s birthday in MM/DD format. Required for Mailchimp’s native birthday automation trigger. ## Events Member events are sent to the Mailchimp Events API and can be used as triggers in Customer Journeys. Event names use lowercase letters and underscores as required by Mailchimp. ### points_updated Fired on every points transaction: earning, spending, expiring, and manual adjustments. PropertyTypeDescription`delta`IntegerPoints change. Positive for earned, negative for spent or expired.`balance_after`IntegerPoints balance after the transaction.`reason_title`StringHuman-readable reason. See the full list below.`source`StringMachine-readable source type.`awarded_at`ISO 8601 datetimeTimestamp of the transaction. **All possible `reason_title` values:** reason_titleWhen it firesOrder purchaseCustomer earns points for placing an order.Order discountCustomer redeems points for a discount on an order.Order cancelledPoints are reversed when an order is cancelled.Order refundedPoints are reversed when an order is refunded.Product reviewCustomer earns points for leaving a product review.Friend referralCustomer earns points for referring a friend.Manual adjustmentAn admin manually adds or removes points.Registration bonusCustomer earns points for creating an account.Birthday bonusPoints awarded on the customer’s birthday.Imported pointsPoints added via CSV import.Points expiredPoints removed due to inactivity expiry. ### rank_achieved Fired when a customer reaches a new rank tier. PropertyTypeDescription`rank_id`IntegerID of the new rank.`rank_name`StringDisplay name of the new rank.`rank_milestone`IntegerPoints threshold for the new rank.`previous_rank_name`StringName of the previous rank. Not present on first rank.`achieved_at`ISO 8601 datetimeTimestamp when the rank was achieved.`coupon_code`StringThe coupon code issued as a rank reward. Only present when a coupon is configured for this rank.`coupon_codes`ArrayAll coupon codes issued when the rank has multiple rewards configured. Only present when more than one coupon is issued. ## Using Events in Customer Journeys In Mailchimp, go to **Automations → Customer Journeys** and create a new journey. For the starting point, choose **API** as the trigger type and select the event name (`points_updated` or `rank_achieved`). You can then add conditional splits based on event properties to route customers into different email branches. For example, split on `reason_title = Birthday bonus` to send a birthday congratulations, or `reason_title = Friend referral` for a referral reward email. --- ### Manual Rewards: Developer Guide and Hooks Reference URL: https://wpgens.com/docs/loyalty-program/manual-rewards-developer-guide-hooks/ The **Manual Reward** type lets you advertise a perk on a rank tier that you, the store owner, fulfil yourself. Examples include a hand-written thank-you card, a free consultation, a physical gift mailed by your team, or a credit applied in a separate billing system. The plugin records that the reward was earned and fires an action hook, but it does not deliver the reward automatically. This guide shows the available hooks and walks through the most common ways to wire manual rewards into your store with custom code. ## What Happens When a Manual Reward Fires When a customer reaches a rank that has an active manual reward configured: - The reward is logged in the plugin debug log. - The action `wpgens_loyalty_rank_reward_issued` is fired with the user, the reward, and the rank. - No email is sent to the customer. - The reward is not marked as claimed in the database, because the plugin has no way to know when you have actually delivered it. - The reward is shown in the rank card on the customer’s loyalty dashboard, but no Claim button appears (those are only rendered for points, discount, and shipping rewards). Everything beyond the log entry is up to you. The hooks below are how you connect that signal to whatever delivery mechanism makes sense for your business. ## Hooks Reference ### wpgens_loyalty_rank_reward_issued The primary action for manual reward delivery. Fired immediately after a manual reward is logged. ``` do_action('wpgens_loyalty_rank_reward_issued', $user_id, $reward, $rank, $message); ``` ArgumentTypeDescription`$user_id`intWordPress user ID of the customer who earned the reward.`$reward`objectReward record. Properties: `id`, `title`, `type` (will be `manual`), `meta` (JSON string), `active`.`$rank`objectRank record. Properties: `id`, `name`, `slug`, `milestone`, `active`.`$message`stringInternal log message. For manual rewards this is always `Manual reward noted`. This hook also fires for points, discount, shipping, and multiplier rewards. Always check `$reward->type` when you only want to handle manual rewards. ### wpgens_loyalty_user_rank_changed Fires once after all rewards for the new rank have been processed. Useful when you want to react to the rank promotion as a whole rather than to each reward individually. ``` do_action('wpgens_loyalty_user_rank_changed', $user_id, $current_rank, $previous_rank, $issued_rewards); ``` **Note:** the `$issued_rewards` array does *not* include manual rewards. Manual rewards are tracked through `wpgens_loyalty_rank_reward_issued` only. To know which manual rewards a rank has, query them with `WPGL_Ranks_Database::get_rank_rewards($current_rank->id, true)`. ## How to Send a Custom Email When a Manual Reward Is Issued This is the most common use case. Hook into `wpgens_loyalty_rank_reward_issued`, filter for the manual type, and send an email with `wp_mail`. ``` add_action('wpgens_loyalty_rank_reward_issued', function ($user_id, $reward, $rank, $message) { if ($reward->type !== 'manual') { return; } $user = get_userdata($user_id); if (!$user || !$user->user_email) { return; } $subject = sprintf('You unlocked a new perk: %s', $reward->title); $body = sprintf( "Hi %s,\n\nCongratulations on reaching the %s rank! You have unlocked: %s.\n\nOur team will be in touch shortly to arrange delivery.\n\nThanks,\nThe Team", $user->display_name, $rank->name, $reward->title ); wp_mail($user->user_email, $subject, $body); }, 10, 4); ``` ## How to Send the Email Only for a Specific Manual Reward If you have multiple manual rewards across different ranks and only one of them should trigger an email, match by reward title or by a custom flag stored in the reward’s meta JSON. ``` add_action('wpgens_loyalty_rank_reward_issued', function ($user_id, $reward, $rank, $message) { if ($reward->type !== 'manual') { return; } // Match by exact title. if ($reward->title !== 'Free Consultation Call') { return; } // Send your custom email here. $user = get_userdata($user_id); wp_mail( $user->user_email, 'Book your free consultation call', "Reply to this email and we will set up your call within 48 hours." ); }, 10, 4); ``` ## How to Notify Your Team in Slack or Microsoft Teams Manual rewards usually require someone on your team to take action. Posting a message to a Slack or Teams webhook is the most reliable way to make sure nothing slips through. ``` add_action('wpgens_loyalty_rank_reward_issued', function ($user_id, $reward, $rank, $message) { if ($reward->type !== 'manual') { return; } $user = get_userdata($user_id); $payload = [ 'text' => sprintf( 'Manual reward to fulfil: *%s* for *%s* (rank: %s, email: %s)', $reward->title, $user->display_name, $rank->name, $user->user_email ), ]; wp_remote_post('https://hooks.slack.com/services/YOUR/WEBHOOK/URL', [ 'headers' => ['Content-Type' => 'application/json'], 'body' => wp_json_encode($payload), 'timeout' => 5, 'blocking' => false, // fire and forget ]); }, 10, 4); ``` ## How to Fire a Klaviyo or Mailchimp Event for a Manual Reward If you want the manual reward to trigger a flow in your email automation platform, fire a custom event from the same hook. The example below uses Klaviyo, but the pattern is the same for any platform. ``` add_action('wpgens_loyalty_rank_reward_issued', function ($user_id, $reward, $rank, $message) { if ($reward->type !== 'manual') { return; } $user = get_userdata($user_id); $payload = [ 'data' => [ 'type' => 'event', 'attributes' => [ 'metric' => ['data' => ['type' => 'metric', 'attributes' => ['name' => 'Manual Reward Issued']]], 'profile' => ['data' => ['type' => 'profile', 'attributes' => ['email' => $user->user_email]]], 'properties' => [ 'reward_title' => $reward->title, 'rank_name' => $rank->name, ], ], ], ]; wp_remote_post('https://a.klaviyo.com/api/events/', [ 'headers' => [ 'Authorization' => 'Klaviyo-API-Key YOUR-PRIVATE-KEY', 'Content-Type' => 'application/vnd.api+json', 'Accept' => 'application/vnd.api+json', 'revision' => '2024-05-15', ], 'body' => wp_json_encode($payload), 'timeout' => 10, ]); }, 10, 4); ``` ## How to Add a Custom Button to a Manual Reward in the Rewards List By default, manual rewards appear in the rank card on the customer’s loyalty page as a title plus optional description, with no action button. To add your own button (for example, a *Book my session* link), override the rank template by copying it into your theme. - Copy `templates/points-ranks.php` from the plugin into your theme at `your-theme/wpgens-loyalty-program/points-ranks.php`. - Find the `foreach ($rewards as $reward)` loop inside `.wpgens-loyalty-rewards-list`. - Add a conditional block that runs only when `$reward->type === 'manual'` and outputs a button or link. ``` [ ]() ``` If you want the button URL or label to differ per reward, store that information in the reward’s meta field as JSON when you create the reward in the admin, then read it back in the template: ``` []() ``` ## How to Track Fulfilment of a Manual Reward Because the plugin does not know when you have delivered a manual reward, you may want to record fulfilment yourself so you can mark them as done in the admin. The simplest pattern is a per-user meta key. ``` // Mark a manual reward as pending when issued. add_action('wpgens_loyalty_rank_reward_issued', function ($user_id, $reward, $rank, $message) { if ($reward->type !== 'manual') { return; } $pending = get_user_meta($user_id, '_my_manual_rewards_pending', true) ?: []; $pending[] = [ 'reward_id' => $reward->id, 'reward_title' => $reward->title, 'rank_id' => $rank->id, 'rank_name' => $rank->name, 'issued_at' => current_time('mysql'), 'fulfilled' => false, ]; update_user_meta($user_id, '_my_manual_rewards_pending', $pending); }, 10, 4); ``` You can then build a small admin page that lists pending rewards across all users and lets your team flip the `fulfilled` flag once the reward has been delivered. ## How to React to All Manual Rewards on a Rank Promotion If a single rank has multiple manual rewards and you want to bundle them into one notification rather than one per reward, react to `wpgens_loyalty_user_rank_changed` instead and query the rank’s rewards yourself. ``` add_action('wpgens_loyalty_user_rank_changed', function ($user_id, $current_rank, $previous_rank, $issued_rewards = []) { if (!$current_rank) { return; } $rewards = WPGL_Ranks_Database::get_rank_rewards($current_rank->id, true); $manual = array_filter($rewards, fn($r) => $r->type === 'manual'); if (empty($manual)) { return; } $titles = wp_list_pluck($manual, 'title'); $user = get_userdata($user_id); wp_mail( $user->user_email, sprintf('Welcome to %s rank — your perks', $current_rank->name), "You unlocked:\n- " . implode("\n- ", $titles) ); }, 10, 4); ``` ## Storing Custom Data on a Manual Reward The reward’s `meta` column is a JSON string. The admin UI uses it for built-in fields like `description`, but you can put any extra keys there to drive your custom logic. Read it back with `json_decode($reward->meta, true)` and use whatever keys you defined. Common patterns include storing a destination URL for a button, a SKU for a physical item, an internal SLA in days, or a tag that another plugin reads. Because the column is opaque JSON, none of these custom keys interfere with the plugin’s own behaviour. --- ### Minimum & Maximum Points Usage URL: https://wpgens.com/docs/loyalty-program/minimum-maximum-points-usage/ ## Limit Points Redemption Per Order You can control how many points a customer must use at minimum and the maximum they’re allowed to apply per order. **To configure:** - Go to **Points & Rewards > Setup**. - In the **Points to Currency Conversion** area, enter: **Minimum Points Required**: Customers can only apply points if they have this amount or more. - **Maximum Points Allowed**: This limits the total number of points that can be redeemed per order. ![WPGens Points and Rewards for WooCommerce - Minimum & Maximum Points Usage](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Minimum-Maximum-Points-Usage.png) 💡 **Tip:** This is especially useful to avoid low-value redemptions or to encourage larger purchases. --- ### Multi-Currency Support for Points and Rewards and Loyalty Program for WooCommerce URL: https://wpgens.com/docs/loyalty-program/multi-currency-support-woocommerce-loyalty-points/ Both **Points and Rewards for WooCommerce** and **Loyalty Program for WooCommerce** include built-in support for the most popular WooCommerce multi-currency plugins. When a customer browses your store in a non-base currency, the plugin automatically converts prices back to your store’s base currency before calculating points. This ensures every customer earns the same number of points for the same purchase, regardless of which currency they use at checkout. ## Why Multi-Currency Support Matters Without multi-currency handling, a customer paying in USD would earn a different number of points than a customer paying the equivalent amount in EUR or GBP, because the exchange rate means the converted price fed into the points engine is wrong. The result is points being over- or under-awarded depending on the active currency, making your loyalty program unpredictable and unfair. Both plugins solve this by normalising every product price to your WooCommerce base currency before the points calculation runs. Customers see prices and checkout totals in their chosen currency as usual. Only the points engine uses the base-currency value internally. ## Supported Multi-Currency Plugins The following plugins are supported out of the box. No additional configuration is required. The integration activates automatically when a supported plugin is detected on your site. ### Aelia Currency Switcher One of the most widely used WooCommerce multi-currency solutions. The integration uses Aelia’s own `wc_aelia_cs_convert` filter to perform an accurate, rate-aware conversion back to the base currency, using the exact same exchange rates Aelia applies to your prices. ### YayCurrency (Free and Pro) YayCurrency is a popular free and Pro currency switcher for WooCommerce. On the Pro version, the integration uses the dedicated `yay_currency_revert_price` filter for maximum accuracy. On the free version, it falls back to dividing by the configured exchange rate directly. ### FOX / WOOCS — WooCommerce Currency Switcher Also known as Currency Switcher for WooCommerce. The integration reads the active currency and its exchange rate from the WOOCS global object, then converts the price back to base currency by dividing by that rate. ### CURCY — WooCommerce Multi Currency by VillaTheme A popular free multi-currency plugin by VillaTheme. The integration uses CURCY’s data class to look up the current currency and its configured exchange rate, then converts the price back to base currency before points are calculated. ## How It Works Both plugins introduce a WordPress filter called `wpgens_loyalty_base_currency_price`. Every time points need to be calculated from a product price, this filter runs first. The built-in implementation detects which supported currency plugin is active and converts the price to base currency accordingly. If no supported plugin is active, the price is passed through unchanged. The filter is applied in three places: - When calculating points to earn for a product on a single product page. - When calculating points for each product inside the cart. - When calculating the total points to award for a completed order. ## Adding Support for Other Currency Plugins If you use a currency plugin not listed above, you can add support with the `wpgens_loyalty_base_currency_price` filter. The filter receives the price in the shopper’s active currency and the product object, and should return the equivalent price in the store’s base currency. This works for both Points and Rewards and Loyalty Program. ``` add_filter( 'wpgens_loyalty_base_currency_price', function( $price, $product ) { $base_currency = get_option( 'woocommerce_currency' ); $active_currency = get_woocommerce_currency(); if ( $active_currency === $base_currency ) { return $price; } // Replace this with your currency plugin's conversion logic. $rate = my_currency_plugin_get_rate( $active_currency ); if ( $rate > 0 ) { return $price / $rate; } return $price; }, 10, 2 ); ``` Place this snippet in your theme’s `functions.php` or in a site-specific plugin. --- ### Omnisend Integration: Events and Custom Properties Reference URL: https://wpgens.com/docs/loyalty-program/omnisend-events-custom-properties-loyalty-program/ The Omnisend integration keeps your contact records in sync with loyalty data through **custom properties** (always-on profile data) and **custom events** (fired when specific actions happen). Both can be used in Omnisend automation workflows to send targeted, personalised emails based on loyalty activity. ## Custom Properties Custom properties are stored on the Omnisend contact record and updated automatically when the corresponding data changes. Omnisend creates custom properties automatically the first time a value is sent, so no manual setup is required. PropertyTypeWhen UpdatedDescription`loyaltyPointsBalance`IntegerEvery points transactionThe customer’s current points balance.`loyaltyPointsLastUpdated`ISO 8601 datetimeEvery points transactionTimestamp of the most recent points change.`loyaltyBirthday`Date (YYYY-MM-DD)When customer saves their birthdayThe customer’s birthday. Use as the trigger date for an Omnisend date-based automation. ## Custom Events Custom events are sent to the Omnisend Events API and can be used as triggers in automation workflows. ### Points Updated Fired on every points transaction: earning, spending, expiring, and manual adjustments. FieldTypeDescription`delta`IntegerPoints change. Positive for earned, negative for spent or expired.`balance_after`IntegerPoints balance after the transaction.`reason_title`StringHuman-readable reason for the change. See the full list below.`source`StringMachine-readable source type.`awarded_at`ISO 8601 datetimeTimestamp of the transaction. **All possible `reason_title` values:** reason_titleWhen it firesOrder purchaseCustomer earns points for placing an order.Order discountCustomer redeems points for a discount on an order.Order cancelledPoints are reversed when an order is cancelled.Order refundedPoints are reversed when an order is refunded.Product reviewCustomer earns points for leaving a product review.Friend referralCustomer earns points for referring a friend.Manual adjustmentAn admin manually adds or removes points.Registration bonusCustomer earns points for creating an account.Birthday bonusPoints awarded on the customer’s birthday.Imported pointsPoints added via CSV import.Points expiredPoints removed due to inactivity expiry. ### Rank Achieved Fired when a customer reaches a new rank tier. FieldTypeDescription`rank_id`IntegerID of the new rank.`rank_name`StringDisplay name of the new rank.`rank_milestone`IntegerPoints threshold for the new rank.`previous_rank_name`StringName of the previous rank. Not present on first rank.`achieved_at`ISO 8601 datetimeTimestamp when the rank was achieved.`coupon_code`StringThe coupon code issued as a rank reward. Only present when a coupon is configured for this rank.`coupon_codes`ArrayAll coupon codes issued when the rank has multiple rewards configured. Only present when more than one coupon is issued. ## Using Events in Omnisend Automations In Omnisend, go to **Automation** and create a new workflow. Choose **Custom event** as the trigger and enter the event name (`Points Updated` or `Rank Achieved`). You can add conditional splits based on event fields to route customers into different branches. For example, filter on `reason_title = Order purchase` to send a points earned notification after every purchase, or `reason_title = Points expired` to send a re-engagement campaign when points expire. For birthday emails, use a **date-based trigger** on the `loyaltyBirthday` custom property instead of relying on the event stream. This ensures the email fires annually on the stored birthday date. --- ### Points and Rewards Menu Overview URL: https://wpgens.com/docs/loyalty-program/points-and-rewards-menu-overview/ The **WPGens Points and Rewards for WooCommerce** plugin features an intuitive menu layout that helps store owners manage loyalty programs with ease. This guide walks you through each main section of the plugin’s sidebar menu and what you can do in each area. ## Dashboard View an overview of all points activity, including: - **Total Points Earned, Spent, and Redemption Rate** - Filter by **date, user, activity type**, or **points** - Download a full report in **CSV format** Use this area to track how your rewards program is performing in real time. ## Members See a list of all registered users in your loyalty program. Key features: - Search by name, email, or points balance - View individual points collected, redeemed, and available - **Import Points** in bulk using a CSV file (choose to add to or replace existing points) Great for manually adjusting or auditing member data. ## Programs → Points & Rewards This section contains the core tools for managing your loyalty program: ### **Setup** Configure how your program works: - Enable/disable the program - Set **points-to-currency conversion** - Define **minimum and maximum** redemption limits - Add or edit **earning** and **redemption actions** Everything begins here – set up the structure of your points system. ### **Settings** Control global behavior of the program: - Choose which **order statuses** trigger point awards - Decide if points apply to **guest users**, **sale products**, **taxes**, or **shipping** - Customize **coupon code prefixes** - Enable **points expiration** and set the duration These settings give you full control over how points are earned and used. ### **Frontend Display** Customize how points info appears across your site: - Set your **points branding** (singular/plural name) - Choose where and how to show: **Points earned** on product, cart, and checkout pages - **Redemption forms** on checkout - Auto-expand or hide forms based on user balance This is key for delivering a smooth and branded customer experience. --- ## Branding Personalize your loyalty program’s look and feel. ### **Landing Page** - Customize the **title**, **subtitle**, and **primary color** - Add this page to your site with the `[WPGENS_POINTS_PAGE]` shortcode or Gutenberg block - Preview how points can be earned and redeemed This is the customer-facing hub for your loyalty program. ### **Emails** Set up and style your automated points emails: #### • **Points Reminder Email** - Send an alert before points expire - Customize content, colors, and images - Insert dynamic tags like `{{user_name}}` and `{{expiry_date}}` #### • **Reward Redeemed Email** - Trigger an email when a customer redeems a reward - Include the reward name, code, and points used Maintain customer engagement with branded, informative emails. ## Integrations ### **Klaviyo** Sync points data to your Klaviyo account: - Real-time updates for points earned, redeemed, or adjusted - Use data for segmentation, flows, and targeted email marketing Just enter your **Klaviyo private API key** to activate. ## Test Mode A small but powerful feature: when enabled, your Points & Rewards program is **active only for admin users**. Use this to test earning actions, redemption rules, or email flows before going live. The new Points and Rewards menu is cleanly organized to give you full control – from setup and branding to tracking and email notifications. Whether you’re launching your first loyalty program or fine-tuning an existing one, each menu section is designed to help you build a rewards system that boosts customer engagement and retention. --- ### Points Conversion Settings URL: https://wpgens.com/docs/loyalty-program/set-how-points-convert-to-discounts-points-conversion/ ## Set How Points Convert to Discounts Define the value of each point and how customers can redeem them for discounts. - Navigate to **Points & Rewards > Setup**. - Scroll to the **Points to Currency Conversion** section. - Set the **conversion rate**, e.g. `10 Points = 1.00 (your currency)`. - Optionally, configure: **Minimum Points Required** – The least amount of points a customer needs to redeem - **Maximum Points Allowed** – Optional limit on how many points can be redeemed per order - **Include Shipping in Discount Calculation** -Allow discounts to apply to shipping costs - **Exclude Taxes from Points Calculation** – Prevent points from being applied to tax portions ![WPGens Points and Rewards for WooCommerce - Setup - Points to currency conversion](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Setup-Points-to-currency-conversion.gif) **Tip:** These rules apply globally unless further limited by reward-specific settings. --- ### Send Advanced WooCommerce Events to Klaviyo URL: https://wpgens.com/docs/dynamic-coupons-for-klaviyo/send-advanced-woocommerce-events-to-klaviyo/ The **Advanced Events** feature in Dynamic Coupons for Klaviyo lets you send detailed, custom tracking events from WooCommerce to Klaviyo. In addition to standard page view event, you can enable tracking for custom post views, category views, and WooCommerce Subscription events. All events are sent with useful details (e.g., category name, page URL) and can be used in Klaviyo Flows or segments to create highly targeted campaigns. ## Step 1 – Enable Advanced Events in the Plugin - In your WordPress dashboard, open the **Dynamic Coupons for Klaviyo** plugin. - Navigate to the **Advanced Events** page. - Select the events you want to track (e.g., **Product Category Views**). - Click **Save**. ## Step 2 – Test the Event Tracking - On your WooCommerce site, perform the action you enabled tracking for — for example, open a product category page like **Jackets**. - In Klaviyo, go to **Analytics → Metrics** (or the event stream) and refresh the page. - Look for the newly captured event (e.g., `View Product Category`) along with its details such as category name and page URL. ## Step 3 – Use the Event in Klaviyo - In Klaviyo, create or edit a **Flow** or **Segment**. - Use your custom event as a trigger or filter. - Build automations or personalized campaigns based on this event data. --- ### Setting Up Email Notifications URL: https://wpgens.com/docs/loyalty-program/setting-up-email-notifications/ Automated emails help you keep customers in the loop and make your loyalty program feel professional and responsive. The Points & Rewards plugin includes two essential email types: - A **Points Expiry Warning Email** to remind users their points will soon expire. - A **Reward Redeemed Email** to confirm when a customer successfully redeems a reward. Both can be customized with your branding, text, images, and links. ## Points Expiry Warning Email This email is sent automatically **30 days before a customer’s points expire**—helping drive redemptions and avoid unused balances. To enable and customize: - Go to **Points & Rewards > Emails** - Locate the **Points Expiry Warning Email** section - Enable the toggle to turn on the email - Customize the following fields: **Subject** - **Logo Image** and width - **Body Image** and width - **Title** - **Email Content** (supports dynamic tags) - **Button Text** and **Button Link** - **Primary Color** (for buttons and accents) You can use dynamic tags in the email body: - `{{user_name}}` – Customer’s name - `{{points_balance}}` – Current balance - `{{store_name}}` – Your store name - `{{expiry_date}}` – The expiration date - `{{expiration_period}}` – Expiry period in days - `{{store_url}}` – Your store’s URL - ![](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Automated-Email-Notifications.gif) Once configured, click **Send Test Email** to preview the email before going live. ## Reward Redeemed Email This email is triggered automatically when a customer redeems points for a reward. It confirms the redemption and shares key details like the reward name and coupon code. To enable and customize: - Got to **Emails > Reward Redeemed Email** - Enable the toggle to turn on the email - Customize all the same elements as above: Subject, logo, body image, title, content, button, and color - Use the following dynamic tags in your message: `{{user_name}}` - `{{reward_name}}` - `{{points_used}}` - `{{redemption_date}}` - `{{reward_code}}` (if applicable) - `{{points_balance}}` - `{{store_name}}` - `{{account_url}}` Use the **Send Test Email** feature here as well to ensure everything looks and works as expected. --- **Tips for Better Engagement:** - Use clear, action-oriented subject lines (e.g., “Your Points Are Expiring Soon!” or “Here’s Your Reward Code 🎉”). - Include a visible CTA button that links directly to your points page or customer account. - Use images that reflect your brand to keep the experience consistent and polished. --- ### Show How Many Points Customers Earn at Cart and Checkout URL: https://wpgens.com/docs/loyalty-program/show-points-customers-earn-cart-checkout/ The `[WPGENS_POINTS_EARNING]` shortcode renders a notice showing how many points the customer will earn for their current cart total. Use it on custom cart or checkout pages built with Elementor, Breakdance, Divi, or any other page builder where the standard WooCommerce hooks do not fire automatically. ``` [WPGENS_POINTS_EARNING] ``` ## Parameters This shortcode accepts no parameters. The message text and format are controlled by your Points Earning message setting under **Points and Rewards → Settings → Earning**. ## What It Displays When placed on a cart or checkout page with an active WooCommerce cart, the shortcode outputs the configured points earning message. For example: *You will earn 120 points for this purchase.* The exact wording is taken from your plugin settings and supports the same template tokens as the built-in hook placement. The shortcode outputs nothing if the cart is empty or the Points Earning feature is disabled in settings. ## When to Use It The standard plugin integration injects the earning notice automatically via WooCommerce cart and checkout hooks. If you have built a custom cart or checkout page with a page builder, those hooks may not fire. Place this shortcode in your custom layout — typically above or below the cart totals — to restore the earning notice. --- ### Show Points Customers Earn on WooCommerce Product Pages URL: https://wpgens.com/docs/loyalty-program/show-points-customers-earn-product-pages/ The `[WPGENS_PRODUCT_EARNING]` shortcode renders the points earning notice for a specific product. Use it on custom product pages built with Elementor, Breakdance, Divi, or any other page builder, or to embed a product earning notice anywhere on your site. ``` [WPGENS_PRODUCT_EARNING] [WPGENS_PRODUCT_EARNING id="123"] ``` ## Parameters ParameterRequiredDefaultDescription`id`NoCurrent product in the loopThe WooCommerce product ID. When omitted the shortcode uses the global `$product` object, which works correctly inside a product loop or on a single product page. ## What It Displays The shortcode outputs the same points earning message as the built-in product page hook. For variable products it respects the variable product logic and updates the displayed points when the customer selects a variation. The message text and format follow the template configured under **Points and Rewards → Settings → Earning**. The shortcode outputs nothing if the product is not found, the user is logged in under a role excluded from earning points, or the Points Earning feature is disabled. ## Usage Examples ### On a custom product page (no id needed) When your page builder is rendering a single product page, the global `$product` object is already set. Simply drop the shortcode wherever you want the notice to appear in your layout. ``` [WPGENS_PRODUCT_EARNING] ``` ### Embed a specific product notice anywhere Use the `id` parameter to display the earning notice for a specific product on any page, such as a homepage featured product section or a landing page. ``` [WPGENS_PRODUCT_EARNING id="123"] ``` --- ### Show Points Redemption on Custom WooCommerce Checkout Pages URL: https://wpgens.com/docs/loyalty-program/show-points-redemption-custom-woocommerce-checkout/ The `[WPGENS_POINTS_CONVERSION]` shortcode renders the points redemption notice that lets customers apply their points balance as a discount at checkout. Use it on custom checkout pages built with Elementor, Breakdance, Divi, or any other page builder where the standard WooCommerce checkout hooks do not fire automatically. ``` [WPGENS_POINTS_CONVERSION] ``` ## Parameters This shortcode accepts no parameters. The output is controlled by your Points Redemption settings under **Points and Rewards → Settings → Redemption**. ## What It Displays When placed on a checkout page with an active WooCommerce cart, the shortcode outputs the points redemption input area. Customers see their available points balance and a button or field to apply those points as a cart discount. The exact appearance follows the styling configured in your plugin settings and your theme. The shortcode outputs nothing if the cart is empty, the customer is not logged in, the customer has no redeemable points, or the redemption feature is disabled in settings. ## When to Use It The standard plugin integration hooks into WooCommerce checkout automatically via the `woocommerce_checkout_order_review` action. If you have replaced the default WooCommerce checkout template with a custom page builder layout, that hook may not fire. In that case, add this shortcode to your custom checkout layout in the position where you want the redemption notice to appear — typically above or below the order summary. --- ### Step-by-Step: Setting Up Your Points & Rewards Program URL: https://wpgens.com/docs/loyalty-program/step-by-step-setting-up-points-and-rewards-program/ Whether you’re launching a loyalty program for the first time or setting one up on a new store, this guide walks you through every essential step using the WPGens Points and Rewards plugin for WooCommerce. ## Step 1: Activate the Points Program - Go to **Points & Rewards > Setup**. - Under **Program Status**, enable the loyalty program. ![WPGens Points and Rewards for WooCommerce - Program status](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Program-status.gif) When active: customers will earn and redeem points based on your settings. When disabled: points features are paused, but your settings are saved. ## Step 2: Enable Test Mode (Optional but Recommended) Test Mode lets you try out your entire program as an admin – without exposing it to real customers. To activate Test Mode: - Go to** WooCommerce > Points & Rewards**. - Locate the **Test Mode** toggle in the bottom left corner. - Toggle **Test Mode** on. ![WPGens Points and Rewards - Test mode](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Test-mode.gif) > While active: - Only site administrators can earn or redeem points. - Points UI is hidden from customers. - Ideal for safely testing rewards, display settings, and email flows. ## Step 3: Set Your Points Conversion Rate - Go to **Points & Rewards > Setup**. - In the **Points to Currency Conversion** section, set your conversion rate. Example: `10 Points = $1.00` - Optional: **Minimum Points Required**: Prevent low-value redemptions. - **Maximum Points Allowed**: Limit how many points can be used per order. - Enable **Include Shipping** to allow points to discount shipping fees. This setting determines how much value customers get when redeeming points at checkout. ![WPGens Points and Rewards - Shipping discount](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Shipping-discount.gif) ## Step 4: Create Earning Actions - Navigate to **Points & Rewards > Setup > Ways to Earn**. - Enable or customize built-in actions such as: **Place Order** (e.g., 1 point per $1) - **Registration** - **Product Review** - **Facebook / Instagram / TikTok Follow** - To add a custom action: Click **Add earning action** - Select an action type, give it a title, assign points, and enable it. ![WPGens Points and Rewards - Add Earning Action](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Add-Earning-Action.png) These actions define how and when customers earn loyalty points. ## Step 5: Set Up Redemption Rewards - Go to **Setup > Ways to Redeem**. - Click **Add redemption action**. - Set the reward: **Title** (e.g., “10% Off”) - **Points Cost** (e.g., 40 points) - Choose a **Coupon Type**: fixed, percentage, product-based, or free shipping - Add optional rules: **Minimum Spent** - **Coupon Duration** - **Included/Excluded Products or Categories** - **Reward Prefix** for unique coupon codes ![WPGens Points and Rewards - Add Redemption Action](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Add-Redemption-Action.png) Customers will redeem points in exchange for these rewards via coupon codes at checkout. ### Optional: Import Starting Points for Existing Customers - Go to **Points & Rewards > Members**. - Click **Import Points**. - Upload a CSV in the format: `email,points` Example: `customer@example.com,150` - Choose whether to: **Add to existing points** - **Replace existing points** - Click **Import** to apply. Imported points immediately appear in the customer’s balance and history. Only use this step if you’re migrating from another system or giving customers a launch bonus. ## Step 6: Frontend display You can control how points and rewards are presented throughout your store, including the cart, checkout, and product pages. These settings help you tailor the experience to match your brand and optimize customer engagement. - Go to **Points & Rewards > Frontend Display** in your WordPress dashboard. - Under **Points Branding**, set the **singular and plural name** for your points (e.g., “Point” / “Points”) to match your store’s tone. - In the **Product Page** section: Enable **Show Points Earning Above Product Price** to display how many points a customer can earn on each product. - Customize the **Points Earning Template** using dynamic tags like: `{{points}}` – The number of points earned - `{{points_label}}` – Automatically outputs “Point” or “Points” - `{{product_price}}` – Displays product price with currency - In the **Points Redemption Form** section: Choose whether to **hide the form when balance is zero**. - Enable **Auto Open** if you want the redemption form to open by default on checkout. - Note: The redemption form appears in the **order review section** if points conversion is enabled and the user has redeemable points. - In the **Points Earning Box** section: Enable **Show Points Earning** to display earned points on the **cart page (non-block carts only)** and the **order review section** at checkout. - Click **Save Settings** after configuring each section. ![WPGens Points and Rewards for WooCommerce - Points Branding](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-Branding.png) **Tip: **These settings help customers see the value of engaging with your store. Make sure to preview them on both the product and checkout pages to ensure everything looks right with your theme. ## Step 7: Customize Landing Page Branding You can personalize the Points & Rewards landing page to match your brand and guide customers through earning and redeeming points. - Go to **Points & Rewards > Display Settings** in your WordPress dashboard. - Scroll to the **Points Page Customization** section. - Customize the following fields: **Primary Color** – This color will be applied to buttons, tabs, costs, and icons on the points page. - **Title** – The main heading shown at the top of the points page (e.g., “Earn & Redeem Points”). - **Subtitle** – A short description to help customers understand the purpose of the points program. - Copy the shortcode **`[WPGENS_POINTS_PAGE]`** and paste it on any page where you want to display the full Points & Rewards landing page. The page will automatically show in the **My Account** tab if placed correctly. - Click **Save Settings**. ![WPGens Points and Rewards for WooCommerce - Landing page](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Landing-page.gif) **Tip:** You can also use the Points Page block if you’re using the Gutenberg editor to place the landing page more visually. ## Step 8: Enable Points Expiration (Optional) - Go to **Points & Rewards > Settings**. - Scroll to **Points Expiration** and enable it. - Set an expiration period in days (e.g., 365). This adds urgency and helps keep your loyalty program engaging over time. ![WPGens Points and Rewards for WooCommerce - Points expiration](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-expiration.png) ## Step 9: Set Up Email Notifications - Go to **Points & Rewards > Emails**. - Configure the two available automated emails: **Points Expiry Warning Email** – Sent 30 days before points expire - **Reward Redeemed Email** – Sent when a customer redeems a reward - Customize: Subject, logo, and body image - Email body text using dynamic tags (e.g. `{{user_name}}`, `{{points_balance}}`) - Button text, link, and color scheme - Send a test email before activating. ![](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Automated-Email-Notifications.gif) Setting up emails keeps your customers informed and builds engagement with timely notifications. ## Step 10: (Optional) Connect to Klaviyo for Marketing Automation - Go to **Points & Rewards > Integrations**. - Enable **Klaviyo Integration** and enter your **Private API Key**. - The plugin syncs: Current points balance - Last points update - Use synced data to: Create segments for high-value customers - Trigger automated flows for expiring points - Personalize email campaigns ![WPGens Points and Rewards for WooCommerce - Klaviyo Integration](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Klaviyo-Integration.gif) Use Klaviyo’s synced data to create targeted email flows, such as reminding customers when their points are about to expire, welcoming them when they first earn points, or offering exclusive rewards to your most loyal shoppers. This allows you to engage customers at the right time with the right message based on their real loyalty behavior. --- Setting up a points and rewards program doesn’t have to be complicated—and now, it isn’t. With just a few steps, you’ve created a system that encourages repeat purchases, builds customer loyalty, and gives shoppers a reason to keep coming back. As your store grows, you can fine-tune earning and redemption rules, personalize email communication, and even connect to marketing tools like Klaviyo to take your loyalty strategy further. Need to test or tweak anything? You can always re-enable Test Mode and make adjustments without impacting live customers. You’re in full control – now go reward your customers for choosing you. --- ### Translate the Loyalty Widget with TranslatePress URL: https://wpgens.com/docs/loyalty-program/translate-loyalty-widget-translatepress/ The loyalty widget in **Loyalty Program for WooCommerce** renders inside an iframe so its styles stay isolated from your theme. The trade-off is that **TranslatePress’s visual editor cannot reach into iframes** to detect or click on the strings inside. To solve this, the plugin ships with a built-in TranslatePress integration that registers every admin-entered widget label into TranslatePress’s database server-side. You translate the strings from the WordPress dashboard like any other content, and the widget renders in the visitor’s language automatically. ## How the Integration Works When TranslatePress is active, the plugin automatically hooks into the widget configuration before it is sent to the iframe. Every label you entered in the widget settings (header title, tab names, button labels, descriptions, guest block text, and so on) is passed through TranslatePress’s translation engine for the visitor’s active language. Strings that already have a translation are returned translated. Strings that do not yet have a translation are inserted into TranslatePress’s regular strings table so they appear in the dashboard for you to translate. The integration activates only when TranslatePress is installed and active. If you do not use TranslatePress, nothing changes: the widget renders in whatever language you entered into the admin fields, exactly as before. ## Setup Steps - **Install and activate TranslatePress.** The free version on the WordPress plugin repository is enough to translate the widget. Premium addons are not required. - **Configure your languages.** Go to *Settings → TranslatePress → General*. Set your default language and add at least one translation language. Save. - **Enable the loyalty widget.** In your WordPress admin, open the Loyalty Program plugin, go to the Widget settings, and make sure the widget is enabled. Fill in the widget text fields (header title, button labels, etc.) in your default language. - **Visit a translated front-end URL.** Open your store on a translated language URL (for example, `/en/` if English is your secondary language). Make sure the loyalty widget is visible on that page. This first visit is what registers the widget strings into TranslatePress’s database. - **Open the String Translation dashboard.** In your WordPress admin, go to *TranslatePress → String Translation*. - **Switch to the Regular tab.** This is the most important step. The widget strings are **not** in the Gettext tab. Click the **Regular** tab in the top of the String Translation screen. - **Pick the target language** from the language dropdown, locate each widget string, enter the translation, and save. - **Reload the translated URL.** The widget now renders with your translations. ## Why the Strings Are on the Regular Tab TranslatePress organises translatable content into two main groups: - **Gettext strings** are strings that developers wrap in PHP translation functions (such as `__()`) inside the plugin code. These are typically built-in labels like error messages or default button text. - **Regular strings** are strings that come from user input, options tables, or any dynamic source. Anything you typed into the widget settings is a regular string. Because the widget labels are content you entered (not hard-coded in the plugin), they live on the **Regular** tab. The Gettext tab is where you would translate the small set of hard-coded labels the widget uses internally, such as “Login Required” or “Free shipping”. ## Which Widget Strings Are Translatable Every admin-entered text field in the widget settings is exposed to TranslatePress. This includes: - Launcher button text - Header title and subtitle - Points program title, description, and tab labels (“Ways to Earn”, “Redeem Points”) - Points redeem button text and reward success message - Referral program title, description, and share link section text - Ranks section title and description - Rewards (coupons) section title and description - Earn Points page title and back button - Redeem Points page title, description, and claim button - Guest block title, description, and call-to-action button text If you add a new string to the widget admin settings later, simply visit a translated URL once with the widget enabled. The new string registers on first render and appears in the Regular tab ready for translation. ## Troubleshooting ### Strings do not appear in the Regular tab Strings register on first front-end render. If they are missing: - Confirm the widget is actually visible on the translated language URL. Open `/en/` (or whatever your secondary language slug is) in a logged-out browser session and check that the widget launcher appears. - Open the widget so its panel renders fully, not just the launcher. - Reload the String Translation dashboard. - If you use page caching, clear the cache for the translated language URL and reload it. ### I translated the strings but the widget still shows the original text - Confirm you saved the translation against the correct target language in the Regular tab. - Clear any page or object cache that might be holding the previous widget configuration. - Hard-refresh the front-end (Cmd+Shift+R or Ctrl+F5) to bypass the browser cache on the widget assets. ### Translations work on the page URL but not when widget data is fetched in the background The integration detects the active language from TranslatePress’s runtime context and, for background requests, from the page URL the request came from. This works on standard subdirectory and subdomain TranslatePress configurations. If you use a non-standard URL structure and run into issues, contact support with details about your setup. ## Compatibility With Other Multilingual Plugins The plugin also ships with a separate WPML integration that handles loyalty emails. The TranslatePress and WPML integrations are completely independent: only the one that matches your active plugin will run. You do not need to disable anything when switching multilingual plugins. --- ## Refer a Friend for WooCommerce ### Add referral indication to the admin order email URL: https://wpgens.com/docs/add-referral-indication-to-the-admin-order-email/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to add a referral indication within the new order email, add this code to functions.php file: ``` add_action('woocommerce_email_order_details', 'add_referral_info_to_order_email', 20, 4); function add_referral_info_to_order_email($order, $sent_to_admin, $plain_text, $email) { // Only add info to admin emails if (!$sent_to_admin) { return; } $raf_id = $order->get_meta('_wpgens_raf_id', true); if (!$raf_id) { return; } $user_query_args = array( 'meta_key' => 'gens_referral_id', 'meta_value' => $raf_id, ); $user_query = new WP_User_Query($user_query_args); $users = $user_query->get_results(); if (!empty($users)) { $user = reset($users); $email = $user->user_email; // $grouped_orders[$raf_id]['user_name'] = $user->first_name ? $user->first_name.' '.$user->last_name : '-'; // $grouped_orders[$raf_id]['user_link'] = get_edit_user_link($user->ID); } else { $email = $raf_id; } echo ' **Referral order, referred by: ' . $email . '** '; } ``` --- ### Add Referral Information to Admin Order Notification Email URL: https://wpgens.com/docs/add-referral-information-to-admin-order-notification-email/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to add referral information when a new order comes, use the code below: ``` add_action('woocommerce_email_order_details', 'action_email_order_details', 10, 4); function action_email_order_details($order, $sent_to_admin, $plain_text, $email) { if ($sent_to_admin) : // Retrieve the raf_info metadata from the order $raf_info = get_post_meta($order->get_id(), '_wpgens_raf_meta', true); // Check if raf_info exists and do something with it if (!empty($raf_info)) { echo 'New Referral order'; echo ' ' . $raf_info["info"] . ' '; } endif; } ``` --- ### Add referral link and sharing options as a lightbox after a successful order URL: https://wpgens.com/docs/add-referral-link-and-sharing-options-as-a-lightbox-after-a-successful-order/ If you want to have a referral link together with sharing icons showing to customers after their successful order, you can do so by following the guide below: 1. Install the free [Popup maker plugin](https://wordpress.org/plugins/popup-maker/) for your site.  2. Create a new popup, and for “conditions” set *Is endpoint to* order-received. As shown in the image below. ![WooCommerce Refer-a-Friend-Add-referral-link-and-sharing-options-as-a-lightbox-after-successful-order conditions](https://wpgens.com/wp-content/uploads/2023/11/WooCommerce-Refer-a-Friend-Add-referral-link-and-sharing-options-as-a-lightbox-after-successful-order-conditions.png) 3. For content, you can add some text explaining the process and then add the shortcode: [WOO_GENS_RAF_ADVANCE url=”http://someurlyouwanttoshare.com”] below it. You should see something like the image below: ![](https://wpgens.com/wp-content/uploads/2023/11/WooCommerce-Refer-a-Friend-Add-referral-link-and-sharing-options-as-a-lightbox-after-successful-order-popup.png) 4. Under triggers, choose auto open and 500ms delay. You can remove the cookies if you want the share popup to appear every time. That’s it. Now, after every successful order, the user will see their referral link and will have the ability to share it. For advanced shortcodes, you can also specify which URL to share. Usually, it would be a landing page, website’s home page, or product you would want to market.  --- ### Additional security: Check unique user meta URL: https://wpgens.com/docs/additional-security-check-unique-user-meta/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! By default, the WooCommerce Refer a Friend plugin checks that the shipping address and email address are unique to prevent fraud. If you have some unique data that every customer needs to have, you can use the code below to check if that data between the referred person and referral is the same, and if it is, prevent the use of the referral system: ``` function gens_check_social_num($raf_info,$order,$referrer_id) { $customer_id = $order->get_user_id(); $customer_number = get_user_meta($customer_id, "social_number", true); $referral_number = get_user_meta($referrer_id, "social_number", true); $enable_referral = "yes"; if(!empty($customer_number) && !empty($referral_number) && ($customer_number == $referral_number)) { $enable_referral = "no"; } if($enable_referral === "no") { $raf_info = array("info" => "Customer added same social security number", "generate" => "false", "increase_referrals" => "false"); } else { $raf_info = array("info" => "All good, coupon will be generated.", "generate" => "true", "increase_referrals" => "true"); } return $raf_info; } add_filter( 'gens_raf_order_info', 'gens_check_social_num',10,3); ``` Just make sure to change “social_number” to the correct user meta.  --- ### Advocate Reward URL: https://wpgens.com/docs/advocate-reward/ This screen under the plugin settings page is used to define the coupon that will be created on every successful transaction that was done via the referral link. If you are not familiar with WooCommerce coupons, you should check the [WooCommerce guide on coupons](https://docs.woocommerce.com/document/coupon-management/), where they are explained in more detail. ## Order-Based Reward & Registration-Based Reward You can select which type of reward you offer by toggling them. ![WooCommerce Refer a Friend advocate reward types of rewards](https://wpgens.com/wp-content/uploads/2023/11/image-14-1024x212.png) Both types of rewards have the same options. - **Coupon type: ** **Percentage discount** – A percentage discount for the entire cart. For example, if the cart contains three (3) t-shirts @ $20 each = $60, a coupon for 10% off applies a discount of $6. - **Fixed cart discount **– A fixed total discount for the entire cart. For example, if the cart contains three (3)  t-shirts @ $20 each = $60, a coupon for $10 off gives a discount of $10. - **Fixed product discount **– A fixed total discount for selected products only. The customer receives a set amount of discount per item. For example, three (3) t-shirts @ $20 each with a coupon for $10 off apply a discount of $30. - **Percentage order discount** – This discount type will create a coupon amount that is equal to % of the order that the referred person made. If a user invited a friend and their friend made an order of $1000 value – if you put 10 in the coupon amount, the person who referred them will get a $100 coupon code. - **Coupon amount:** Fixed value or percentage, depending on the discount type you choose. Enter without a currency unit or a percent sign, which are added automatically, e.g., Enter ’10’ for $10 or 10%. - **Products:** Products that the coupon will be applied to, or that need to be in the cart in order for the “Fixed cart discount” to be applied. If you are using this option, make sure to enter product IDs here, not product slug or name. - **Exclude products: **Products that the coupon will not be applied to, or that cannot be in the cart in order for the “Fixed cart discount” to be applied. If you are using this option, make sure to enter product IDs here, not product slug or name. - **Product categories: **Product categories that the coupon will be applied to, or that need to be in the cart in order for the “Fixed cart discount” to be applied. Make sure to enter category ID-s, separated by a comma. - **Exclude categories: **Product categories that the coupon will not be applied to, or that cannot be in the cart in order for the “Fixed cart discount” to be applied. Make sure to enter category ID-s, separated by a comma. - **Coupon Duration**: This option allows you to set how many days the coupon should last. To set it, type a number, like 30. - **Minimum Order**: You can define the minimum order subtotal in order for the coupon to work. For example, if you put 50, it means that the order subtotal needs to be at least 50 for the referral link to create a coupon. - **Individual Use:** Check this box if the coupon cannot be used in conjunction with other coupons. - **Limit usage to X items – **The maximum number of individual items this coupon can apply to when using product discounts. Leave blank to apply to all qualifying items in the cart. - **Generate a coupon on every nth referral –** By default, coupons are generated on every referral order. If you want to generate on every third, place number 3, on every 5th, place number 5 and so on. Leave empty for default – on every order. ![WooCommerce Refer a Friend advocate reward order based reward](https://wpgens.com/wp-content/uploads/2023/11/image-15-993x1024.png) The only mandatory field here is Coupon type and Coupon Amount. All other fields are just optional. *Leaving “Products” and “Exclude Products” blank allows the coupon to be applied to the entire store.* **IMPORTANT:** Coupons are created and sent **after** an order is marked as *Complete*. [](https://wpgens.com/docs/advocate-reward/#betterdocs-form-modal) --- ### Automatically apply coupons for users who have referred friends URL: https://wpgens.com/docs/automatically-apply-coupons-for-users-who-have-referred-friends/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to automatically apply all available coupons for customers who have referred friends, add the code below to function.php ``` add_action( 'woocommerce_before_calculate_totals', 'wpgens_auto_apply_coupons_checkout', 10, 1 ); function wpgens_auto_apply_coupons_checkout( $cart ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return; if(!is_user_logged_in()) return; $user_info = get_userdata(get_current_user_id()); $user_email = $user_info->user_email; $date_format = get_option( 'date_format' ); $args = array( 'posts_per_page' => 10, 'post_type' => 'shop_coupon', 'post_status' => 'publish', 'meta_query' => array ( 'relation' => 'AND', array ( 'key' => 'customer_email', 'value' => $user_email, 'compare' => 'LIKE' ), array ( 'key' => 'usage_count', 'value' => '0', 'compare' => '=' ) ), ); $raf_coupons = array(); $coupons = get_posts( $args ); if($coupons) { $i = 0; foreach ( $coupons as $coupon ) { if(!$cart->has_discount( $coupon->post_title ) && substr( $coupon->post_title, 0, 3 ) === "RAF" ){ $cart->add_discount( $coupon->post_title ); } } } } ``` This code will then automatically add coupons that the customer hasn’t used yet when they get to the checkout page. This is useful for users who have a large number of smaller coupons that they can combine.  --- ### Change Refer a friend tab title on My Account page URL: https://wpgens.com/docs/change-refer-a-friend-tab-title-on-my-account-page/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to change the Refer a Friend tab title that is located under the *My Account* page, you need to add this code to functions.php file: ``` add_filter('gens_raf_tab_title', function () { return 'Your text'; }); ``` But if you want to translate it to be used by multiple languages, use a translation plugin such as Loco Translate or WPML.  --- ### Connecting referral links to MailChimp URL: https://wpgens.com/docs/connecting-referral-links-with-mailchimp/ If you want to include the users’ referral codes in the mailing list that you are sending via MailChimp, or if you just want to send a mass email to all registered users telling them about the new referral program, follow the steps below: - First, read [this article](https://wpgens.com/docs/how-to-generate-referral-links-for-old-customers/) to generate referral links for old customers.  - Install MailChimp for WordPress – [https://wordpress.org/plugins/mailchimp-for-wp/](https://wordpress.org/plugins/mailchimp-for-wp/) - Install its addon MailChimp User Sync – [https://wordpress.org/plugins/mailchimp-sync/](https://wordpress.org/plugins/mailchimp-sync/) - Once the plugins are installed, you need to set them up. Go to MailChimp for WP and enter MailChimp API key.  [Get your API key here.](https://admin.mailchimp.com/account/api) - If everything looks good, you will see a *Status Connected* message in green. - Go to User Sync Screen. Choose the list you want to sync to. IMPORTANT: If you only see the First and Last names, make sure that your list has defined the field for a referral code. By default, when creating a list inside MailChimp, you only have Email, First and Last name. What you want to do is add one more field, by clicking on List -> Settings -> List Fields. You will see a screen like the one below. Just add a new text field and hit save. ![WooCommerce Refer a Friend Connecting referral links with MailChimp merge tags](https://wpgens.com/wp-content/uploads/2023/11/WooCommerce-Refer-a-Friend-Connecting-referral-links-with-MailChimp-merge-tags.png) - If you just added a new field in MailChimp, you need to fetch the list again by going to MailChimp for WordPress plugin and clicking on the *Renew MailChimp List* button.  - Next, on the “User Sync” screen, it should say *send additional fields*. Choose gens_referral_id as the user meta. On the right, click to connect it to the newly made MailChimp field.  - If you just installed the plugin and want to sync old users, there is a “Manual Sync” button below, that should sync all existing users. - Now you can use the referral code in your email. Make sure to add it inside a link after ?raf=, for example, if your referral tag is RAFCODE – the link should be: [http://www.mysite.com/some-page/?raf=*|RAFCODE|*](http://www.mysite.com/some-page/?raf=*|RAFCODE|*) Those are all the steps, just make sure to test it out before sending it to your customers. --- ### Coupon not being generated for a person even after they referred someone URL: https://wpgens.com/docs/coupon-not-being-generated-for-a-person-even-after-they-referred-someone/ If you are sure that someone made an order through a referral link, and the person whose link was used did not get a coupon code, read below how to troubleshoot: 1. First, make sure that the order is marked as *Complete*. Coupon codes are sent only once the order is marked as *Complete*. 2. If the order was completed, on the right side of the order edit screen, look for the Refer a Friend Data box. This box should give a clue about what is happening. The box should look like the image below, except that referral notes should say that all is fine and the coupon will be generated: ![woocommerce refer a friend Coupon not being generated for a person even after they referred someone](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-Coupon-not-being-generated-for-a-person-even-after-they-referred-someone.png) Under the referral notes, you should see a message explaining why the coupon code was not generated. It could be a potential fraud detection, which could be due to the person using their own referral code or using a different email address but the same billing address. It could also be due to the fact that you allow referring only new users, and the person referred an existing user – you can change this under the General settings of the plugin. 3. If, instead of this box, you see a message that says **“No referral data”**, that means that the order was not saved as referred order. This happens if the cookie was not presented during the checkout process. 4. If you are still having the issue, please get in touch with us, by clicking on the contact link at the top right corner. --- ### Developers – Action Hooks and Filters URL: https://wpgens.com/docs/developers-action-hooks-and-filters/ - `before_wpgens_raf_init` – Runs before the RAF plugin init ``` do_action('before_wpgens_raf_init'); ``` - `after_wpgens_raf_init` – Runs after the RAF plugin init ``` do_action('after_wpgens_raf_init'); ``` - `gens_after_referral_url` – Runs after displaying the referral URL ``` do_action('gens_after_referral_url'); ``` - `wpgens_raf_new_user_referral_id` – Fires when a new user gets a referral ID ``` do_action('wpgens_raf_new_user_referral_id', $referral_id, $user_id); ``` - `gens_new_user_registration` – Fires on new user registration ``` do_action('gens_new_user_registration', $referral_id, $user_id); ``` - `new_raf_data` – Records data for analytics purposes ``` // New order event do_action('new_raf_data', 'new_order', array( 'user' => $user_id, 'referral' => $referrer_id, 'order' => $order_id, 'generate' => $generate_bool, 'increase_referrals' => $increase_bool )); // New coupon event do_action('new_raf_data', 'new_coupon', array( 'user' => $user_id, 'order' => $order_id, 'coupon_id' => $coupon_id )); // Email sent event do_action('new_raf_data', 'email_sent', array( 'email' => $email, 'subject' => $subject, 'type' => $type, 'coupon_code' => $coupon_code )); // Coupon applied event do_action('new_raf_data', 'coupon_applied', array( 'user' => $user_id, 'referral' => $referrer_id, 'type' => $type // 'code' or 'link' )); // User referred event do_action('new_raf_data', 'user_referred', array( 'user' => $user_id, 'referrer' => $referrer_id )); // Subscription renewal event do_action('new_raf_data', 'subscription_renewal', array( 'user' => $user_id, 'order' => $order_id )); ``` - `gens_before_generate_user_coupon` – Fires before a coupon is generated ``` do_action('gens_before_generate_user_coupon', $user_id, $type, $order); ``` - `gens_after_generate_user_coupon` – Fires after a coupon is generated ``` do_action('gens_after_generate_user_coupon', $user_id, $type, $order, $coupon_id); ``` - `gens_raf_send_referral_coupon` – Fires after sending a referral coupon email ``` do_action('gens_raf_send_referral_coupon', $email, $coupon_code, $type); ``` - `gens_raf_auto_apply_coupon` – Fires when a coupon is automatically applied ``` do_action('gens_raf_auto_apply_coupon', $referrer_id); ``` - `gens_raf_checkout_check` – Fires during checkout coupon validation ``` do_action('gens_raf_checkout_check', $guest_coupon_code, $referrer_id); ``` - `send_referral_notification_email_event` – Fires when a referral notification email is sent ``` do_action('send_referral_notification_email_event', $user_id); ``` - `wpgens_raf_order_status` – Filter the order status that triggers coupon generation ``` add_action('woocommerce_order_status_' . apply_filters('wpgens_raf_order_status', 'completed'), array(__CLASS__, 'gens_maybe_create_send_coupon'), 10, 1); ``` = Filter Hooks = - `wpgens_raf_locate_template` – Filter template location ``` $template = apply_filters('wpgens_raf_locate_template', $template, $template_path, $guest_view); ``` - `gens_raf_tab_title` – Filter the title of the RAF tab in My Account ``` $title = apply_filters("gens_raf_tab_title", __('Refer a Friend', 'gens-raf')); ``` - `gens_raf_coupon_prefix` – Filter the coupon prefix ``` $prefix = apply_filters('gens_raf_coupon_prefix', $this->type === "friend" ? 'gens_raf_friend' : 'gens_raf', $this->type); ``` - `gens_raf_generate_coupon` – Control whether to generate a coupon ``` $generate = apply_filters("gens_raf_generate_coupon", true, $order_id); ``` - `wpgens_raf_code` – Filter the referral code ``` $referral_id = apply_filters('wpgens_raf_code', $referral_id); ``` - `wpgens_raf_link` – Filter the referral link ``` $refLink = apply_filters('wpgens_raf_link', $refLink, $referral_id, $type); ``` - `wpgens_raf_tab_disable` – Control whether to disable RAF tab on product pages ``` $tabs_hide = apply_filters('wpgens_raf_tab_disable', $this->settings_field_active('gens_raf_tabs_disable')); ``` - `gens_raf_coupon_data` – Filter coupon data ``` $data = apply_filters('gens_raf_coupon_data', array( 'discount_type' => $discount_type, 'amount' => $amount, 'free_shipping' => $free_shipping, 'minimum_amount' => $minimum_amount, 'individual_use' => $individual_use === "yes" ? true : false, 'exclude_sale_items' => $exclude_sale_items === "yes" ? true : false, 'product_ids' => array_map('intval', (array) explode(',', $product_ids)), 'excluded_product_ids' => array_map('intval', (array) explode(',', $exclude_product_ids)), 'product_categories' => array_map('intval', (array) $product_categories), 'excluded_product_categories' => array_map('intval', (array) $exclude_product_categories), 'id' => true ), $coupon_id, $user_id, $coupon_code); ``` - `gens_raf_minimum_order_amount` – Filter minimum order amount ``` $minimum_amount = apply_filters('gens_raf_minimum_order_amount', get_option('gens_raf_min_ref_order'), $order_id); ``` - `gens_raf_custom_message` – Filter the custom message for order info ``` $custom_msg = apply_filters('gens_raf_custom_message', $custom_msg); ``` - `gens_raf_order_info` – Filter the RAF order info ``` $raf_info = apply_filters("gens_raf_order_info", $raf_info, $order, $referrer_id); ``` - `gens_raf_coupon_applied` – Filter the message shown when a coupon is applied ``` $message = apply_filters("gens_raf_coupon_applied", __('Coupon Applied!', 'gens-raf')); ``` - `gens_raf_should_remove_coupon` – Control whether a coupon should be removed from cart ``` $should_remove_coupon = apply_filters('gens_raf_should_remove_coupon', $should_remove_coupon, $guest_coupon_code, $referrer_id); ``` - `gens_raf_coupon_removal_message` – Filter the coupon removal message ``` $coupon_removal_message = apply_filters('gens_raf_coupon_removal_message', __('The coupon has been removed from your cart. You are an existing customer and are not entitled to a referral discount.', 'gens-raf')); ``` - `gens_raf_fraud_order_status` – Filter the order statuses used for fraud detection ``` $statuses = apply_filters('gens_raf_fraud_order_status', array_keys($all_statuses)); ``` - `wpgens_raf_title` – Filter the title displayed on My Account page ``` $title = apply_filters('wpgens_raf_title', __('Unused Refer a Friend Coupons', 'gens-raf')); ``` - `gens_raf_coupons_query` – Filter the query for getting user’s unused coupons ``` $args = apply_filters("gens_raf_coupons_query", array( 'posts_per_page' => -1, 'post_type' => 'shop_coupon', 'post_status' => 'publish', 'meta_query' => array( array( 'key' => 'customer_email', 'value' => $user_email, 'compare' => 'LIKE' ) ), ), $user_email); ``` - `gens_raf_points_amount` – Filter the points amount for Points & Rewards integration ``` $points = apply_filters("gens_raf_points_amount", get_option('wc_points_rewards_wpgens_raf'), $order); ``` - `wpgens_raf_disallowed_email_roles` – Filter user roles that should not receive referral emails ``` $disallowed_roles = apply_filters('wpgens_raf_disallowed_email_roles', array()); ``` - `wpgens_subscription_renewal_coupons_number` – Filter the number of coupons that can be used for subscription renewals ``` $posts_per_page = apply_filters('wpgens_subscription_renewal_coupons_number', 999); ``` - `gens_raf_discount_type` – Filter the coupon discount type ``` $discount_type = apply_filters($prefix . "_discount_type", $discount_type); ``` - `gens_raf_coupon_amount` – Filter the coupon amount ``` $amount = apply_filters($prefix . "_coupon_amount", $amount, $order_id); ``` - `wpgens_user_has_orders_status_list` – Filter the order statuses used to check if a user has orders ``` $status_list = apply_filters('wpgens_user_has_orders_status_list', array('wc-processing', 'wc-completed')); ``` --- ### Display a custom message to customers coming from a referral link URL: https://wpgens.com/docs/display-a-custom-message-to-customers-coming-from-a-referral-link/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to write text on the checkout screen to customers coming through a referral link, add the code below to the functions.php file: ``` add_action('woocommerce_before_checkout_form', 'my_custom_message'); function my_custom_message() { if ( isset($_COOKIE['gens_raf']) ) { wc_print_notice( __('This is my custom message'), 'notice' ); } } ``` Depending on your theme, customers should see something along the lines of what’s shown in the image below. ![](https://wpgens.com/wp-content/uploads/2023/11/WooCommerce-Refer-a-Friend-Display-custom-message-to-customers-coming-from-referral-link-returning-customer-1024x440.png) --- ### Display Settings RAF URL: https://wpgens.com/docs/display-settings/ Every registered user has a couple of ways to access their referral link and share it with their friends: - My Account page – Refer a friend tab - Single product page – Refer a friend tab - Landing page – customer-made with shortcode ### My Account page These options are used for the “My Account” page and every user registered with your WooCommerce store has access to them. On this page, there will be a “Refer a friend” tab where the user can check their referral stats. **My Account Page Share Link **– Paste the page URL that you want your users to use for sharing their referral link. If you’d like, you can push a specific product through this URL, but if not, you can just leave it empty and the URL will default to the store’s home page. Additionally, you can create a landing page explaining some of the benefits of coming through a referral link. **Description text** – This is the text shown above the share icons. HTML is allowed. ![WooCommerce Refer a friend Display Settings My account page](https://wpgens.com/wp-content/uploads/2023/11/image-1-1024x387.png) Here’s an example of what that would look like on the front end. ![WooCommerce Refer a friend Display Settings Referral Program Landing page](https://wpgens.com/wp-content/uploads/2023/11/WooCommerce-Refer-a-friend-Display-Settings-Referral-Program-Landing-page-441x1024.png) ### Single Product page If you want to have a “Refer a friend” tab on each product, go to plugin settings -> Woo Product Tab and enable this option. [Click here and log in](http://itsgoran.com/wp/product/woo-single-2/) to see what it looks like. You have two options here - one is the text to place above the share links, and some call-to-action text. - the other is the guest text that will show for users who are not logged in. ![WooCommerce Refer a friend Display Settings Landing page](https://wpgens.com/wp-content/uploads/2023/11/image-2-1024x487.png) ### Landing page The logic behind this is to create a custom page that will have the WooCommerce Refer a Friend advanced shortcode in it, which then shows both the referral link and sharing icons. You can customize this page to add some explanation to the store visitior, as well as show display the reward for program engagement.  Here are a few examples of how advanced shortcode is used:  - [https://www.birchandfog.com/refer-a-friend/](https://www.birchandfog.com/refer-a-friend/) - [https://www.forceofnatureclean.com/lp-refer-friend-program/](https://www.forceofnatureclean.com/lp-refer-friend-program/) ### Share settings With the updated layout, you can also set up different share settings, such as handles, social sharing, etc. ![WooCommerce Refer a friend Display Settings Share settings](https://wpgens.com/wp-content/uploads/2023/11/image-3-1024x518.png) --- ### Email Settings URL: https://wpgens.com/docs/email-settings/ You can configure the content of email templates by going to Settings -> Email Settings. WooCommerce Refer a Friend plugin allows you to set up the following options. ## General settings General email settings allow you to: - disable email sending entirely – if you don’t want to inform customers of their coupon via email - select to use the default WooCommerce email template ![WooCommerce Refer a friend email settings general settings](https://wpgens.com/wp-content/uploads/2023/11/image-4-1024x220.png) ## Email templates By default, you have the option to send an email to everyone who shares an email through your Referral program. ![WooCommerce Refer a friend Email Settings Share Email](https://wpgens.com/wp-content/uploads/2023/11/image-8-1024x615.png) There are also 2 different email templates that the WooCommerce Refer a Friend plugin can send after a successful order. ### Coupon email The first one is the [Advocate Reward](https://wpgens.com/docs/advocate-reward/) email, where a coupon code is sent to the person who referred a friend. ![WooCommerce Refer a friend coupon email](https://wpgens.com/wp-content/uploads/2023/11/image-5-1024x500.png) ### Friend coupon email The second one is the [Friend Reward](https://wpgens.com/docs/friend-reward/), where a coupon code is sent to the referred person. You can select to turn this reward ON or OFF. ![WooCommerce Refer a friend friend coupon email](https://wpgens.com/wp-content/uploads/2023/11/image-6-1024x387.png) As for the look of email templates, 2.0 version of the plugin comes with nicely styled email templates that you can use. Or if you prefer to use WooCommerce email templates, just check the second option as shown above. Below is an example of what the email template looks like. ![](https://wpgens.com/wp-content/uploads/2023/08/email.jpeg) Besides the content, you can change the colors, logo, and footer text/copyright. These options are defined under WooCommerce Settings -> bottom of the “Emails” tab. We are using WooCommerce fields for those options to keep everything within the same place as your other WooCommerce emails. ### Advanced email template changes You can easily make direct changes to email template files. Just copy the file that you want to change from the templates folder of the plugin to the /wpgens-raf/ folder under your active theme folder, and any change you make to these files will stay after the plugin is updated. Just like it’s done with the WooCommerce files. --- ### Fraud Prevention URL: https://wpgens.com/docs/fraud-prevention/ WooCommerce Refer a Friend plugin offers several fraud prevention rules. You have the following options: - Disable IP check - Disable email check - Disable street address check - Fraud email address ![WooCommerce Refer a Friend Fraud Prevention](https://wpgens.com/wp-content/uploads/2023/11/image-9-1024x440.png) By default, all fraud prevention rules are turned on. If you are testing the program, you can disable any rule, but for production, we suggest keeping these options ON. --- ### Friend Reward URL: https://wpgens.com/docs/friend-reward/ If you want to introduce double-sided incentives for your customers, you can also reward the referred person, otherwise known as the *friend.* You can set up all coupon options for that on the Friend Reward page. ## First Purchase Discount Enabling this option will allow you to automatically apply a coupon to a person being referred to your site via someone’s referral link, which means on their first purchase. First, go to the WooCommerce coupons page (WooCommerce -> Coupons) and manually create a coupon, choose the options you want, and make sure it does not have a limit or email restriction. Then put the coupon code in the textbox “Coupon CODE”. You can also write a message to your customers in the textbox below the Coupon Code. ![WooCommerce Refer a Friend Friend Reward First Purchase Discount](https://wpgens.com/wp-content/uploads/2023/11/image-17-1024x421.png) ## Post-First Purchase Coupon Choose this option to issue a coupon to the user after they have successfully completed their first order. The coupon will be provided to them as a reward for their initial purchase, encouraging them to return and make future purchases. - **Coupon type:** **Percentage discount** – A percentage discount for the entire cart. For example, if the cart contains three (3) t-shirts @ $20 each = $60, a coupon for 10% off applies a discount of $6. - **Fixed cart discount** – A fixed total discount for the entire cart. For example, if the cart contains three (3)  t-shirts @ $20 each = $60, a coupon for $10 off gives a discount of $10. - **Fixed product discount** – A fixed total discount for selected products only.  The customer receives a set amount of discount per item. For example, three (3) t-shirts @ $20 each with a coupon for $10 off apply a discount of $30. - **Percentage order discount** – This discount type will create a coupon amount that is equal to % of the order that the referred person made. If a user invited a friend and their friend made an order of $1000 value – if you put 10 in the coupon amount, the person who referred them will get a $100 coupon code. - **Coupon amount:** Fixed value or percentage, depending on the discount type you choose. Enter without a currency unit or a percent sign, which are added automatically, e.g., Enter ’10’ for $10 or 10%. - **Products:** Products that the coupon will be applied to, or that need to be in the cart in order for the “Fixed cart discount” to be applied. If you are using this option, make sure to enter product IDs here, not product slug or name. - **Exclude products:**  Products that the coupon will not be applied to, or that cannot be in the cart in order for the “Fixed cart discount” to be applied. If you are using this option, make sure to enter product IDs here, not product slug or name. - **Product categories:** Product categories that the coupon will be applied to, or that need to be in the cart in order for the “Fixed cart discount” to be applied. Make sure to enter category ID-s, separated by a comma. - **Exclude categories:** Product categories that the coupon will not be applied to, or that cannot be in the cart in order for the “Fixed cart discount” to be applied. Make sure to enter category ID-s, separated by a comma. - **Coupon Duration:** This option allows you to set how many days a coupon should last. To set it, type a number, like 30. - **Minimum Order:** You can define the minimum order subtotal in order for the coupon to work. So for example, if you put 50, it means that the order subtotal needs to be at least 50 for a referral link to create a coupon.  - **Individual Use: **Check this box if the coupon cannot be used in conjunction with other coupons.  - **Limit usage to X items:** The maximum number of individual items this coupon can apply to when using product discounts. Leave blank to apply to all qualifying items in the cart. ![WooCommerce Refer a Friend Friend Reward Post-First Purchase Coupon](https://wpgens.com/wp-content/uploads/2023/11/image-18-1024x548.png) The only mandatory field here is Coupon type and Coupon Amount. All other fields are just optional. *Leaving “Products” and “Exclude Products” blank allows the coupon to be applied to the entire store.* --- You can choose between rewarding customers after they have made the first purchase, where they get a coupon via email to be used on their next purchase, or you can reward them right away by applying a coupon code automatically on the cart/checkout screen, after they have arrived via the referral link. It’s up to you, but **make sure to have only one of those active,** or else you will be rewarding customers two times.[](https://s3.amazonaws.com/helpscout.net/docs/assets/59f5c94804286331992403ca/images/59f6722b2c7d3a272c0d3730/file-v3YXQfNZo9.jpg) If you are not familiar with WooCommerce coupons, you should check the [WooCommerce guide on coupons](https://docs.woocommerce.com/document/coupon-management/),  where they are explained in more detail. --- ### General Settings URL: https://wpgens.com/docs/general-settings/ The settings screen is located under **WooCommerce > Refer a Friend** > **Settings**. It allows you to set up the following options: ## Program status ![WooCommerce Refer a Friend Program status](https://wpgens.com/wp-content/uploads/2023/11/image-10-1024x150.png) You can enable or disable the referral program. If you select to disable it, referral links won’t work, coupons won’t be generated, and the program will be entirely hidden from your customers. ## Refer a Friend General Settings General settings allow you to do the following: **Enable referral codes** – By default, a user can invite a friend via a link. With this option, users can invite friends with referral codes, as well. Their friend will insert them as coupons to get a defined discount. **Enable referral links for guests** – If checked, guests will be able to get referral links as well. This works in shortcode and product tabs. **Hide the referral link for users without any orders** – If checked, users who don’t have at least a single order won’t see their referral code and link. **No orders text** – This text appears instead of a referral link for users who don’t have any orders. If you choose to hide the link from them, add a note such as *Referral code is available only to users with at least one order.* **Cookie Time** – Once the user comes to your site via a referral link, a cookie is saved on their browser. As long as the cookie stays, the person who referred them will get the reward. Once the cookie expires, a reward (coupon) won’t be generated and that order won’t be marked as a referral order. **Minimum referral order** – Set how much someone needs to purchase in order to generate a coupon for the referral. Leave blank to disable this option. **Delete Cookie after a Purchase** – If this is checked, a cookie will be removed after user comes to thank you screen. If this option is unchecked, the next time this customer makes another purchase, if the cookie doesn’t expire by itself, they will generate a reward for the person who referred them UNLESS they generated it before. ![WooCommerce Refer a Friend General referral settings](https://wpgens.com/wp-content/uploads/2023/11/image-11-1024x745.png) ## WooCommerce Subscription WooCommerce Refer a Friend plugin is compatible with the WooCommerce Subscription plugin. Check the *Enable integration* to enable the auto-applying of coupons to subscription renewal. It also works with payment gateways that support [recurring total modifications.](https://docs.woocommerce.com/document/subscriptions/payment-gateways/#advanced-features) The way it works is that during renewal, it will automatically apply the coupon code to the renewal order if the user has coupon codes from referrals. If coupon value equals renewal price, they will get a free subscription for that period.   **You can also choose the following options:** **Apply All Coupons** – Checking this means that the plugin will automatically apply all user’s available coupons (if they have more than one) during the next renewal, up to the renewal price. If they have more coupons than the renewal price, the coupons will be used during the next renewal period. **Exclude shipping** – Check this box if you want to exclude shipping from being discounted in Woo Subscription renewals. This only applies to renewals. ![WooCommerce Refer a Friend WooCommerce Subscription settings](https://wpgens.com/wp-content/uploads/2023/11/image-12-1024x353.png) --- Learn more about how you can benefit from using [WooCommerce Refer a Friend plugin with WooCommerce Subscriptions](https://wpgens.com/using-a-referral-plugin-with-woocommerce-subscriptions/). --- ### Generate a coupon code on every nth referral. URL: https://wpgens.com/docs/generate-a-coupon-code-on-every-nth-referral/ By default, the WooCommerce Refer a Friend plugin will generate a coupon code for every successful referral. In order to reward customers on every *nth* referral, you can use the built-in feature. Just navigate to WooCommerce -> Refer a Friend -> Advocate Reward and click on *Show advanced options*. ![](https://wpgens.com/wp-content/uploads/2023/11/image-19.png) --- ### Grant points to the referrer based on a fixed percentage of the amount spent by their friend (Points & Rewards plugin) URL: https://wpgens.com/docs/grant-points-to-the-referrer-based-on-a-fixed-percentage-of-the-amount-spent-by-their-friend-points-rewards-plugin/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you are using the WooCommerce Points & Rewards plugin, and you want to grant points to the referrer based on a fixed percentage of the amount spent by their friend, add this code to your function.php file and change 0.01 which is 1% to the amount you want. In the example below – if a friend buys something worth 100$, a user will receive 1$ worth of points. ``` add_filter( 'gens_raf_points_amount', 'change_points_amount', 10, 2); function change_points_amount($points,$order){ $points = intval($order->get_total() * 0.01); return $points; } add_filter( 'gens_raf_generate_coupon', '__return_false' ); ``` --- ### Guest coupons getting removed on checkout URL: https://wpgens.com/docs/guest-coupons-getting-removed-on-checkout/ If a user is getting a message such as this one: ![woocommerce refer a friend guest coupons getting removed on checkout](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-guest-coupons-getting-removed-on-checkout.jpeg) It means that the coupon code that you set for the guest has an email restriction. To fix the issue, go to that coupon edit screen and remove any email restriction from it. Also, if you did not enable the option for existing users to get discounts on the general screen and they try to make a purchase via referral code, the coupon will be removed once they are on the checkout page as it will only work for new users. --- ### Hide the referral link for customers without an order URL: https://wpgens.com/docs/hide-the-referral-link-for-customers-without-an-order/ You can hide the referral link for customers without any order by navigating to WooCommerce -> Refer a Friend -> General settings. ![WooCommerce Refer a Friend Hide Referral Link](https://wpgens.com/wp-content/uploads/2023/11/image-13-1024x106.png) --- ### How to add user referral code to every order details email? URL: https://wpgens.com/docs/how-to-add-user-referral-code-to-every-order-details-email/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you do not have guest referral codes enabled, add this: ``` function gens_raf_customer_email( $order, $sent_to_admin, $plain_text ) { $user_id = ( version_compare( WC_VERSION, '2.7', ' --- ### How to automatically add a (free) product to a user’s cart when they visit through a referral link? URL: https://wpgens.com/docs/how-to-automatically-add-a-free-product-to-a-users-cart-when-they-visit-through-a-referral-link/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! Let’s say you want to reward users coming through a referral link by giving them a free product. In order to do so, copy this code to the theme functions.php file and change $product_id = 64 to your product ID.  ``` add_action( 'gens_raf_auto_apply_coupon', 'gens_add_product_to_cart' ); function gens_add_product_to_cart() { if(!isset($_COOKIE["gens_raf"])) { return false; } $product_id = 64; $found = false; //check if product already in cart if ( sizeof( WC()->cart->get_cart() ) > 0 ) { foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) { $_product = $values['data']; if ( $_product->id == $product_id ) $found = true; } // if product not found, add it if ( ! $found ) WC()->cart->add_to_cart( $product_id ); } else { // if no products in cart, add it WC()->cart->add_to_cart( $product_id ); } } ``` Once you add this code, every user that comes through referral link will get that product added to their cart. --- ### How to Connect Klaviyo to Refer a Friend for WooCommerce URL: https://wpgens.com/docs/connect-klaviyo-refer-a-friend-woocommerce/ Refer a Friend Premium for WooCommerce includes a built-in Klaviyo integration that automatically syncs referral codes to customer profiles and fires a **Referral Code Created** event whenever a new code is generated. This lets you build personalised email flows in Klaviyo that reference each customer’s unique referral code or trigger immediately after a code is created. This guide covers the Klaviyo private API key permissions you need, how to set up the integration in the plugin, and what data is sent to Klaviyo. ## Required Klaviyo API Key Permissions The integration uses two Klaviyo API endpoints, so your private API key must have the following scopes enabled when you create it: ScopeAccess LevelUsed For**Profiles**Read and WriteCreating or updating the customer profile and storing the referral code as a custom property.**Events**WriteFiring the `Referral Code Created` event whenever a new referral code is generated. If you want to keep the API key minimal for security, only enable these two scopes. A full-access key also works. ## Step 1: Create the Klaviyo Private API Key - Log in to your Klaviyo account. - Go to **Account → Settings → API Keys**. - Click **Create Private API Key**. - Give the key a descriptive name, for example *Refer a Friend Plugin*. - Choose **Custom Key** to set granular scopes. - Enable **Profiles → Read and Write** and **Events → Write**. - Click **Create** and copy the key. You will not be able to see it again after closing the dialog. ## Step 2: Enable the Integration in the Plugin - In your WordPress admin, go to **Refer a Friend → Integrations**. - Find the **Klaviyo** section. - Toggle **Enabled** to on. - Paste your private API key into the **API Key** field. - Click **Save**. The integration is now active. From this point on, every newly generated referral code will be sent to Klaviyo automatically. ## What Data Is Sent to Klaviyo ### Profile Properties When a referral code is created, the plugin upserts the customer profile in Klaviyo with the following fields: FieldTypeDescription`email`StringCustomer’s email address. Used as the unique profile identifier.`first_name`StringCustomer’s first name. Only sent when available.`last_name`StringCustomer’s last name. Only sent when available.`referral_code`String (custom property)The customer’s unique referral code. Use this in email templates as `{{ person.referral_code }}`.`referral_created_date`ISO 8601 datetime (custom property)Timestamp when the referral code was created. ### Event: Referral Code Created Immediately after the profile is updated, the plugin fires a `Referral Code Created` metric event. Use this event as the trigger for a Klaviyo flow that sends the referral code to the customer. PropertyTypeDescription`referral_code`StringThe newly created referral code.`user_type`StringEither `registered_user` (the customer has a WordPress account) or `guest_user` (generated from a guest checkout or signup form).`created_at`ISO 8601 datetimeTimestamp when the code was created.`unique_id`String (SHA-256 hash)Deterministic ID derived from email, code, user type, and timestamp. Prevents duplicate events if the request is retried. ## Building a Welcome Flow in Klaviyo - In Klaviyo, go to **Flows → Create Flow → Create From Scratch**. - Set the trigger to **Metric → Referral Code Created**. - Add an Email step. - In the email body, insert the placeholder `{{ person.referral_code }}` wherever you want the referral code to appear. You can also use `{{ event.referral_code }}` to pull the code directly from the triggering event. - Optionally add a Trigger Split filtering on `user_type = registered_user` if you want different copy for guest signups. - Activate the flow. ## Migrating From the Old Code Snippet Earlier versions of this guide showed a custom snippet that hooked into `wpgens_raf_new_user_referral_id` and called the Klaviyo API directly from `functions.php`. That snippet is no longer needed. The built-in integration covers the same use case, plus it adds the `Referral Code Created` event for flow triggers and supports both registered and guest users. If you have the legacy snippet in your theme’s `functions.php` or in a custom site plugin, remove it before enabling the built-in integration to avoid sending each referral code twice. --- ### How to disable a referral link for specific users URL: https://wpgens.com/docs/how-to-disable-a-referral-link-for-specific-users/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to hide a referral link from specific customers, copy the code below and change emails to emails of customers you want to hide the referral link from. ``` add_filter('wpgens_raf_code','gens_raf_code',10,1); function gens_raf_code($raf_code) { $emails_list = ['johndoe@gmail.com','peter@wpgens.com']; $current_user = wp_get_current_user(); if(in_array($current_user->user_email, $emails_list)) { return 'Referral code is available only to Editors'; } return $raf_code; } add_filter('wpgens_raf_link','gens_raf_link',10,3); function gens_raf_link($raf_link, $referral_id, $type) { $emails_list = ['johndoe@gmail.com','peter@wpgens.com']; $current_user = wp_get_current_user(); if(in_array($current_user->user_email, $emails_list)) { return 'Referral link is available only to Editors'; } return $raf_link; } add_action('wp','wpgens_custom_account_tabs'); function wpgens_custom_account_tabs(){ $emails_list = ['johndoe@gmail.com','peter@wpgens.com']; $current_user = wp_get_current_user(); if(in_array($current_user->user_email, $emails_list)) { $gens_plugin = WPGens_RAF::instance(); remove_filter( 'woocommerce_account_menu_items', array($gens_plugin->my_account,'gens_account_menu_item'),10); } } ``` Change the text to the one you want to show for other user roles. --- ### How to earn points instead of coupons URL: https://wpgens.com/docs/how-to-earn-points-instead-of-coupons/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you are using our Points and Rewards plugin, you can disable generating of coupons and add points earning instead by using the code below. Change amount of points per your needs. ``` // Add points instead of referral coupon add_action('gens_before_generate_user_coupon', function ($user_id, $type, $order) { $points = 200; // Add points do_action( 'wpgens_loyalty_update_points', $user_id, $points, WPGL_Points_Activity_Type::EARN, WPGL_Points_Source_Type::REFER_FRIEND, $order ? $order->get_id() : null, 'Referral reward' ); }, 10, 3); // Prevent coupon generation add_filter('gens_raf_generate_coupon', function ($generate, $order_id) { return false; }, 10, 2); ``` --- ### How to edit template files and keep them after plugin update? URL: https://wpgens.com/docs/how-to-edit-template-files-and-keep-them-after-plugin-update/ Version 2 of the Refer a friend plugin was completely written from scratch and now ships with the easy-to-edit front-end templates. So, if you want to edit HTML markup, or some text on any of the front-facing screens of the plugin, such as the My Account tab, product RAF tab, shortcode look, or even emails that are sent via share or to referrals when they get a coupon reward, you can do so easily by following the guide below: 1. Create `wpgens-raf` folder inside your active theme. 2. Go to the `/wpgens-refer-a-friend-premium/templates/` directory and copy files from this directory to newly made `wpgens-raf` folder inside your theme. You can copy only the files that you want to edit, but keep in mind that you need to follow the structure, so email templates must be inside the emails folder as it is in the templates directory. That’s it. You can now safely edit files from within your theme and you don’t need to worry that they will be overwritten once a new update comes. It acts exactly like WooCommerce templates do. If you don’t see the templates folder, that means you are using an older version of the plugin, update it to 2.0.x --- - [How to manually update WooCommerce Refer a Friend plugin?](https://wpgens.com/docs/how-to-manually-update-the-plugin/) - [How to enable auto-updates?](https://wpgens.com/docs/how-to-enable-auto-updates/) --- ### How to enable a referral link for a specific user role only URL: https://wpgens.com/docs/how-to-enable-a-referral-link-for-a-specific-user-role-only/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to allow only a specific user group to access the referral link, i.e. editor role, add the following code to the functions.php file: ``` add_filter('wpgens_raf_code','gens_raf_code',10,1); function gens_raf_code($raf_code) { if( !current_user_can('editor') && !current_user_can('administrator') ) { return 'Referral code is available only to Editors'; } return $raf_code; } add_filter('wpgens_raf_link','gens_raf_link',10,3); function gens_raf_link($raf_link, $referral_id, $type) { if( !current_user_can('editor') && !current_user_can('administrator') ) { return 'Referral link is available only to Editors'; } return $raf_link; } add_action('wp','wpgens_custom_account_tabs'); function wpgens_custom_account_tabs(){ if( !current_user_can('editor') && !current_user_can('administrator') ) { $gens_plugin = WPGens_RAF::instance(); remove_filter( 'woocommerce_account_menu_items', array($gens_plugin->my_account,'gens_account_menu_item'),10); } } ``` Change the text to the one you want to show for other user roles. --- ### How to enable a referral link for users with active Subscription URL: https://wpgens.com/docs/how-to-enable-a-referral-link-for-users-with-active-subscription/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to allow referral link only to a user that has an active WooCommerce subscription, add the following code to the functions.php file: ``` /** * Check if a user has an active WooCommerce subscription. * Requires WooCommerce Subscriptions (wcs_user_has_subscription). */ if ( ! function_exists( 'my_has_active_subscription' ) ) { function my_has_active_subscription( $user_id = 0 ) { // Default to current user if ( empty( $user_id ) && is_user_logged_in() ) { $user_id = get_current_user_id(); } // Not logged in or no id if ( empty( $user_id ) ) { return false; } // If Subscriptions isn't active, treat as no active subscription if ( ! function_exists( 'wcs_user_has_subscription' ) ) { return false; } return (bool) wcs_user_has_subscription( $user_id, '', 'active' ); } } /** * Show RAF code only to users with an active subscription. */ add_filter( 'wpgens_raf_code', 'gens_raf_code_active_sub_only', 10, 1 ); function gens_raf_code_active_sub_only( $raf_code ) { $user_id = get_current_user_id(); if ( ! my_has_active_subscription( $user_id ) ) { return 'Referral code is available only to customers with an active subscription.'; } return $raf_code; } /** * Show RAF link only to users with an active subscription. */ add_filter( 'wpgens_raf_link', 'gens_raf_link_active_sub_only', 10, 3 ); function gens_raf_link_active_sub_only( $raf_link, $referral_id, $type ) { $user_id = get_current_user_id(); if ( ! my_has_active_subscription( $user_id ) ) { return 'Referral link is available only to customers with an active subscription.'; } return $raf_link; } /** * Hide the RAF "My Account" tab if user doesn't have an active subscription. * (Matches your previous behavior of removing the tab for disallowed users.) */ add_action( 'wp', 'wpgens_custom_account_tabs_active_sub_only' ); function wpgens_custom_account_tabs_active_sub_only() { // Only act for logged-in users if ( ! is_user_logged_in() ) { return; } $user_id = get_current_user_id(); if ( ! my_has_active_subscription( $user_id ) ) { if ( class_exists( 'WPGens_RAF' ) ) { $gens_plugin = WPGens_RAF::instance(); remove_filter( 'woocommerce_account_menu_items', array( $gens_plugin->my_account, 'gens_account_menu_item' ), 10 ); } } } ``` --- ### How to enable auto updates? URL: https://wpgens.com/docs/how-to-enable-auto-updates/ Once you purchase the plugin, you will receive a license key that enables one-click updates for the plugin directly from your website’s *Plugins* page. In order to enable automatic updates, you need to add a License Key: - Go to [WPGens.com -> My Account -> Purchase History](https://wpgens.com/checkout/purchase-history/). - Click on the “View licenses” link. - Click on a key icon to view the license key and copy it. - Go to your site and navigate to: WooCommerce > Refer a Fiend > Automatic Updates. - Paste the key in the box on the right and click “Save”. - After the key is saved, your license will be Activated. ![woocommerce refer a friend auto updates](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-auto-updates-1024x411.png) This will enable one-click updates directly from the plugin screen, just like other WordPress repository plugins allow you to update them. The license key lasts for one year after the purchase. In order to continue with the plugin updates, you need to renew it after it expires. --- ### How to export referral codes URL: https://wpgens.com/docs/how-to-export-referral-codes/ Before exporting referral (RAF) codes, please make sure to do the following: - Generate missing codes as explained under [How to generate referral links for old customers?](https://wpgens.com/docs/how-to-generate-referral-links-for-old-customers/) - Next, install the WordPress Export Users plugin – you can find it here – https://wordpress.org/plugins/import-users-from-csv-with-meta/ - Lastly, under the Export tab, type this for columns field user_email,gens_referral_id --- ### How to Find Your Webflow Site ID and Collection ID URL: https://wpgens.com/docs/webflow-blog-sync/how-to-find-your-webflow-site-id-and-collection-id/ ## Finding Your Site ID: - Open your Webflow project. - Go to **Project Settings > General**. - Copy the **Site ID** from the General tab. ## Finding Your Collection ID: - In the Webflow Designer, go to **CMS Collections**. - Open your blog collection (e.g., Posts). - The **Collection ID** can be found in the collection settings or URL. --- ### How to generate referral links for old customers? URL: https://wpgens.com/docs/how-to-generate-referral-links-for-old-customers/ By default, Refer a Friend plugin will generate referral links for every new user that registers with your site, whereas for already registered users it will be generated as soon as they view any page where their referral link is showing.  But, if you need to generate it at once for all your past customers – in case you want to send an email with a referral link to all your customers – just go to WooCommerce -> Status -> Tools and click on the “Create Referrals” button. Before this, make sure the option to hide referral links for users without orders is turned off, under general plugin settings. ![woocommerce refer a friend How to generate referral links for old customers? create referrals](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-How-to-generate-referral-links-for-old-customers-create-referrals-1024x447.jpeg) --- ### How to Generate Your Webflow API Token URL: https://wpgens.com/docs/webflow-blog-sync/how-to-generate-your-webflow-api-token/ - Log in to your Webflow account. - Go to **Account Settings > Workspace Settings**. - Click on **API Access**. - Click **Generate New Token** and copy it. - Paste this token into the Webflow API Token field in the plugin settings. Make sure the token has access to CMS and Collection permissions. --- ### How to give a discount to the person who came through the referral link? URL: https://wpgens.com/docs/how-to-give-a-discount-to-the-person-who-came-through-the-referral-link/ Let’s say you want to give a 20% discount to the person that came through a referral link. The first thing you need to do is create a coupon that will apply to every person who came through a referral link. 1. Go to Woocommerce -> Coupons and create a new coupon. 2. Match the settings to those on the screenshot below (click to zoom in). Add a name to the coupon (I named it guest_coupon), make the type percentage discount, and add a coupon amount: ![](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-How-to-give-a-discount-to-the-person-who-came-through-the-referral-link-guest-1024x369.png) 3. Go to Plugins settings ( WooCommerce -> Settings -> Refer a friend tab), then go to Referred person coupon settings tab, and at the bottom of that tab match the settings to the screenshot below: ![](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-How-to-give-a-discount-to-the-person-who-came-through-the-referral-link-settings-1024x312.png) That’s it! --- ### How to give a free product to a customer who refers a friend? URL: https://wpgens.com/docs/how-to-give-a-free-product-to-a-customer-who-refers-a-friend/ If you want to give a free product to customers who refer a friend, you must do the following: - Navigate to WooCommerce Refer a Friend Settings -> **Advocate reward** - Select *Product Discount* as the coupon type. - Set *the Coupon Amount* to equal the price of the product you would like to exchange for a coupon Check the image below to see an example of such a configuration. ![How to give a free product to a customer who refers a friend advocate reward](https://wpgens.com/wp-content/uploads/2023/11/image-20-1024x557.png) Next, under *Include products*, click to select a product you would like to give for free.[](https://s3.amazonaws.com/helpscout.net/docs/assets/59f5c94804286331992403ca/images/5a6788e02c7d3a39e6264887/file-qf5LnYzSyP.png) ![](https://wpgens.com/wp-content/uploads/2023/11/image-21.png) After you’re done with that, navigate to** Email** **Settings,** and under *Coupon email*, write a message that will let your customers know the code they received will give them a free product.  --- ### How to hide ‘Share by email’ URL: https://wpgens.com/docs/how-to-hide-share-by-email/ You can hide the ‘Share by email’ option by navigating to Settings -> Email Settings and clicking the toggle *Hide share via email option.* ![WooCommerce Refer a friend Hide share by email](https://wpgens.com/wp-content/uploads/2023/11/image-7-1024x98.png) --- ### How to hide a specific social share button? URL: https://wpgens.com/docs/how-to-hide-a-specific-social-share-button/ Each social share icon has its own class that you can use and target to hide from the front end. You can do this by adding the code below to your theme style.css file. In the menu click on Appearance -> Editor. **To remove facebook share add this code:** .gens-referral_share__fb { display:none!important; } **To remove twitter share add this code:** .gens-referral_share__tw { display:none!important; } **To remove google plus share add this code:** .gens-referral_share__gp { display:none!important; } Place it at the bottom of your style.css file which is the first one that opens when you go to Appearance -> Editor. Also, make sure to clear your website’s cache and browser cache to see the changes. --- ### How to hide/show RAF product tab for specific product category? URL: https://wpgens.com/docs/how-to-hide-show-raf-product-tab-for-specific-product-category/ If you want to hide the Refer a Friend product tab from a specific category of products, you can use the code below – just change “clothing” to your category slug. That way, the Refer a Friend product tab won’t be shown for that category of products. But if you want to hide it from every category except a particular one, just put “!” before in_array (without quotes) and change ‘clothing’ to the category you want the product tab to display. ``` add_action('wp','wpgens_exclude_product_tab'); function wpgens_exclude_product_tab(){ if(is_product()) { global $post; $terms = wp_get_post_terms( $post->ID, 'product_cat' ); foreach ( $terms as $term ) $categories[] = $term->slug; if ( in_array( 'clothing', $categories ) ) { remove_filter('woocommerce_product_tabs',array( WPGens_RAF::instance()->product_tab, 'raf_product_tab')); } } } ``` --- ### How to Make the Dynamic Text Translatable with Polylang URL: https://wpgens.com/docs/how-to-make-the-share-text-field-translatable-with-polylang/ If you’re using Polylang on your site, you can make the **Share Text**, the **My Account Text**, and the **Reward Box Texts** from Refer a Friend fully translatable. Follow this step-by-step guide to enable translations for these options. --- ## Step 1: Register the Dynamic Texts for Translation You need to tell Polylang which fields should be translatable. Add the following code to your theme’s `functions.php` file or inside your custom plugin: ``` add_action( 'init', function() { if ( function_exists( 'pll_register_string' ) ) { // Share Text (product pages / shortcode) pll_register_string( 'Refer a Friend Share Text', get_option( 'gens_raf_share_text' ), 'Refer a Friend' ); // My Account tab text pll_register_string( 'Refer a Friend My Account Text', get_option( 'gens_raf_myaccount_text' ), 'Refer a Friend' ); // Rewards Box Texts pll_register_string( 'Refer a Friend - Rewards Box', get_option( 'gens_raf_rewards_box' ), 'Refer a Friend' ); pll_register_string( 'Refer a Friend - You Receive Label', get_option( 'gens_raf_you_receive' ), 'Refer a Friend' ); pll_register_string( 'Refer a Friend - You Receive Reward', get_option( 'gens_raf_you_receive_reward' ), 'Refer a Friend' ); pll_register_string( 'Refer a Friend - Friend Receives Label', get_option( 'gens_raf_friend_receive' ), 'Refer a Friend' ); pll_register_string( 'Refer a Friend - Friend Receives Reward', get_option( 'gens_raf_friend_receive_reward' ), 'Refer a Friend' ); } }); ``` **Explanation:** - Each option value is registered separately. - They are grouped under **“Refer a Friend”** inside Polylang. --- ## Step 2: Adjust Your Templates to Use Translations First copy template files to your theme per: [https://wpgens.com/docs/how-to-edit-template-files-and-keep-them-after-plugin-update/ ](https://wpgens.com/docs/how-to-edit-template-files-and-keep-them-after-plugin-update/ ) --- ### 2.1. Update the Share / My Account Text Template The `modern/parts/text.php` template is shared: on product pages it receives the **Share Text**, and on the My Account tab it receives the **My Account Text**. So do not hardcode a single option here, instead translate the value that is passed in. Update `modern/parts/text.php` to this: ``` ``` **Notes:** - `pll__()` fetches the translated text. - `wp_kses_post()` safely allows basic HTML tags like ``, ``, etc. - Because this template is shared, do **not** hardcode `get_option('gens_raf_share_text')` here, or the My Account tab will show the product Share Text instead of the My Account Text. --- ### 2.2. Update the Reward Box Template Under modern/parts/rewards.php update code to this: ``` ``` **Notes:** - Again, we use `pll__()` for translation and `wp_kses_post()` for safe output. - If the Reward Box content is empty, nothing will be displayed. --- ## Step 3: Translate the Texts in Polylang Once the code is added: - Log into your WordPress Dashboard. - Navigate to: **Languages → Translations**. - Search by group: **Refer a Friend**. - You will find all the texts: Share Text - My Account Text - Rewards Box - You Receive Label - You Receive Reward - Friend Receives Label - Friend Receives Reward - Enter your translations for each language. - Save Changes. Done! Now the Share Text, the My Account Text, and the Reward Box Texts will dynamically appear in the correct language. --- ### How to manually change users referral code/link? URL: https://wpgens.com/docs/how-to-manually-change-users-referral-code-link/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to manually edit a referral code for a user – maybe they want a referral code that is easier to remember – add this code to your function.php file. ``` add_action( 'show_user_profile', 'gens_raf_user_referral_fields' ); add_action( 'edit_user_profile', 'gens_raf_user_referral_fields' ); function gens_raf_user_referral_fields( $user ) { ?> Module Options Refer a friend link --- ### How to manually update the plugin? URL: https://wpgens.com/docs/how-to-manually-update-the-plugin/ Automatic updates are preferred. In order to have them, you need to have a valid license key added to your site. [Check this tutorial](https://wpgens.com/docs/how-to-enable-auto-updates/) on how to enable automatic updates. If you are having some issues with automatic updates, feel free to contact us. This tutorial explains how to manually update the plugin: - Go back to [wpgens.com](https://wpgens.com/) and log in. - After you log in in, go to My Account -> Download Items - On this screen, you have a list of purchased plugins, click on View Details and Downloads. - At the bottom of this screen, there is a link to the zip file of a plugin. Click on it to download the plugin. ![woocommerce refer a friend how to manually update the plugin](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-how-to-manually-update-the-plugin-1024x330.png) - Now go to your website’s plugin screen and delete the WooCommerce Refer a friend Premium plugin. (Don’t worry, nothing will be lost). - Next, upload the new version you downloaded, install it, and activate it. That’s it. Make sure to read [a tutorial on how to enable automatic updates](https://wpgens.com/docs/how-to-enable-auto-updates/) in the future. --- ### How to remove Refer a Friend Tab from My Account page URL: https://wpgens.com/docs/how-to-remove-refer-a-friend-tab-from-my-account-page/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! In case you are using the shortcode on the My Account page, you might want to remove the Refer a Friend tab. In that case, add the code below to function.php. ``` add_action('wp','wpgens_custom_account_tabs'); function wpgens_custom_account_tabs(){ $gens_plugin = WPGens_RAF::instance(); remove_filter( 'woocommerce_account_menu_items', array($gens_plugin->my_account,'gens_account_menu_item'),10); } ``` --- ### How to Restrict the Referral Program to Subscribed Users in WooCommerce Subscription URL: https://wpgens.com/docs/how-to-restrict-the-referral-program-to-subscribed-users-in-woocommerce-subscription/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! To hide the “Refer a friend” tab on the “My Account” page for non-subscription users and only show it for users with active or pending cancellation subscriptions, you can copy the code below to functions.php ``` add_filter('wpgens_raf_code', 'gens_raf_code', 10, 1); function gens_raf_code($raf_code) { $current_user = wp_get_current_user(); if (!user_has_active_subscription($current_user->ID)) { return 'Referral code is available only to subscription users'; } return $raf_code; } add_filter('wpgens_raf_link', 'gens_raf_link', 10, 3); function gens_raf_link($raf_link, $referral_id, $type) { $current_user = wp_get_current_user(); if (!user_has_active_subscription($current_user->ID)) { return 'Referral link is available only to subscription users'; } return $raf_link; } add_action('wp', 'wpgens_custom_account_tabs'); function wpgens_custom_account_tabs(){ $current_user = wp_get_current_user(); if (!user_has_active_subscription($current_user->ID)) { $gens_plugin = WPGens_RAF::instance(); remove_filter('woocommerce_account_menu_items', array($gens_plugin->my_account, 'gens_account_menu_item'), 10); } } function user_has_active_subscription($user_id) { if (function_exists('wcs_user_has_subscription')) { return wcs_user_has_subscription($user_id, '', 'active') || wcs_user_has_subscription($user_id, '', 'pending-cancel'); } return false; } ``` ### Explanation: - **`user_has_active_subscription` function**: This function checks if the user has an active or pending cancellation subscription using the `wcs_user_has_subscription` function provided by WooCommerce Subscriptions. - **Filters for referral code and link**: These filters now check if the user has an active subscription before returning the referral code or link. - **Custom account tabs**: This action checks if the user has an active subscription before removing the “Refer a friend” tab from the account menu. Make sure that WooCommerce Subscriptions is installed and activated, as this code relies on its functions. --- ### How to send a coupon on other order status than complete? URL: https://wpgens.com/docs/how-to-send-a-coupon-on-other-order-status-than-complete/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to generate a coupon code and send an email with a coupon on some other order status than *Complete*, you need to add this code to functions.php file: ``` function gens_raf_change_status( $status ) { $status = "processing"; return $status; } add_filter('wpgens_raf_order_status', 'gens_raf_change_status'); ``` --- ### How to set up which image to share through the Share buttons? URL: https://wpgens.com/docs/how-to-set-up-which-image-to-share-through-the-share-buttons/ Unfortunately, Facebook no longer allows passing the image that you want through share buttons, instead, they are all defined in the *header* via og:image tag. You can add this tag manually or through a plugin: 1. **Manually**: If for some reason, you are not using SEO by Yoast, you can manually add og:image tag by following the second section of [this tutorial.](http://www.wpbeginner.com/wp-themes/how-to-add-facebook-open-graph-meta-data-in-wordpress-themes/) 2. **Via SEO by Yoast plugin:** In SEO by Yoast, the most popular WordPress plugin for SEO, you can define which image to share by following this tutorial: [https://kb.yoast.com/kb/why-doesnt-facebook-display-an-image/](https://kb.yoast.com/kb/why-doesnt-facebook-display-an-image/) Depending on which page your customers are sharing, you need to set up an image for that page. So if in plugin settings, you defined that the *My Account* page referral link will be the home page, then you need to set up a social image on the home page. In order to test which image is sharing for you, you can use [this debugger tool](https://developers.facebook.com/tools/debug/). Just click *Scrape again* if you replace the image and you don’t see a new one appearing.  --- ### How to Stack Referral Rewards Into a Single Coupon URL: https://wpgens.com/docs/stack-referral-rewards-single-coupon/ By default, every time a referral order is completed the advocate (the referrer) receives a brand new reward coupon. Some stores prefer the opposite behavior: keep a single coupon per advocate and simply increase its amount with every successful referral, so the customer always redeems the same growing coupon. This guide provides a code snippet that does exactly that, and explains an important limitation around percentage based coupons. ## Before you start This is a custom code snippet, not a built in setting. Add it through a child theme functions.php file or, recommended, a small mu-plugin. Always test on a staging site first. ## The snippet ``` /** * Refer a Friend, stack the advocate reward onto ONE coupon * instead of issuing a new coupon every time a referral completes. */ add_action( 'gens_before_generate_user_coupon', function ( $user_id, $type, $order ) { // Only the advocate (referrer) reward. Leave friend/registration coupons alone. if ( 'referrer' !== $type || ! $order ) { return; } $prefix = 'gens_raf'; $discount_type = get_option( $prefix . '_coupon_type' ); $amount = get_option( $prefix . '_coupon_amount' ); // "Percent of order total" is converted to a real currency amount per order, // exactly like the plugin does, so it CAN be stacked safely. if ( 'order_percent' === $discount_type ) { $order_total = $order->get_total() - $order->get_total_tax(); if ( get_option( 'gens_raf_subscription_exclude_shipping' ) ) { $order_total -= $order->get_total_shipping(); } $discount_type = 'fixed_cart'; $amount = number_format( $order_total * ( $amount / 100 ), 2, '.', '' ); } $amount = apply_filters( $prefix . '_coupon_amount', $amount, $order->get_id() ); // Only stack fixed-amount coupons. Stacking a straight percentage (10% + 10%) // is meaningless and unbounded, so for those we just let a normal new coupon be made. if ( 'fixed_cart' !== $discount_type && 'fixed_product' !== $discount_type ) { return; } // Resolve the advocate email the same way the plugin does. $email = ''; if ( is_string( $user_id ) && strpos( $user_id, 'ref' ) === 0 ) { $db = new WPGens_RAF_DB(); $guest = $db->get_guest_referral_by_code( $user_id ); if ( $guest ) { $email = $guest['email']; } elseif ( $numeric = WPGens_RAF_User::get_id_from_referral_code( $user_id ) ) { $u = get_userdata( $numeric ); $email = $u ? $u->user_email : ''; } } elseif ( is_email( $user_id ) ) { $email = $user_id; } elseif ( $u = get_userdata( $user_id ) ) { $email = $u->user_email; } if ( ! $email ) { return; } // Find this advocate existing (oldest) RAF coupon of the same type. $existing = get_posts( array( 'post_type' => 'shop_coupon', 'post_status' => 'publish', 'numberposts' => -1, 'orderby' => 'date', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'customer_email', 'value' => strtolower( $email ) ), array( 'key' => 'discount_type', 'value' => $discount_type ), ), ) ); $master = null; foreach ( $existing as $c ) { if ( strpos( $c->post_title, 'RAF-' ) !== 0 ) { continue; // only our referral coupons } $used = (int) get_post_meta( $c->ID, 'usage_count', true ); $limit = (int) get_post_meta( $c->ID, 'usage_limit', true ); if ( $limit && $used >= $limit ) { continue; // already redeemed, do not top up a used coupon } $master = $c; break; } // No existing unused coupon, let the plugin create one normally (first reward). if ( ! $master ) { return; } // Top up the existing coupon. $current = (float) get_post_meta( $master->ID, 'coupon_amount', true ); update_post_meta( $master->ID, 'coupon_amount', $current + (float) $amount ); // Prevent a NEW coupon from being created for this generation only // (self-removing so the friend coupon in the same request is unaffected). $one_shot = function () use ( &$one_shot ) { remove_filter( 'gens_raf_generate_coupon', $one_shot ); return false; }; add_filter( 'gens_raf_generate_coupon', $one_shot ); }, 10, 3 ); ``` ## How it works - It hooks into `gens_before_generate_user_coupon`, which runs right before the plugin builds the reward coupon, and it acts only on the advocate (referrer) reward. Friend and registration coupons keep their normal behavior. - If the advocate already has an unused `RAF-` coupon, the snippet adds the current order reward to that coupon amount and cancels creation of a new one through the `gens_raf_generate_coupon` filter. The filter removes itself, so the friend coupon generated later in the same request is not affected. - The growing total appears automatically under My Account, Refer a Friend, because that list reads the coupon amount live. ## Important: percentage coupons Whether a reward can be stacked depends on the coupon type you use. Coupon typeStacked?WhyFixed cart / Fixed productYesReal currency amounts add up cleanly, for example 5 plus 8 equals 13.Percent of order total (order_percent)YesThe plugin already converts this into a fixed amount per order before saving, so each reward contributes a real currency value.Plain percentage (percent, recurring_percent, and similar)NoAdding 10% plus 10% to reach 20% is unbounded and rarely intended. For these types the snippet keeps the default behavior and a separate new coupon is issued. ## A note about emails When the snippet tops up an existing coupon, the plugin does not send a reward email for that top up, and the order _raf_coupon_generated flag is not set. The advocate sees the increased balance in their My Account tab. A reward email is still sent the first time the coupon is created. If you also want a notification on every top up, that requires a few extra lines, so reach out to support. ### Will this work with percentage coupons? Yes for the Percent of order total type, because the plugin converts it to a real currency amount per order before saving. It does not stack plain percentage coupons, since adding 10% to 10% is unbounded and rarely intended. For plain percentage coupons a new separate coupon is issued as usual. ### Does it affect the friend (referred customer) coupon? No. The snippet only acts on the advocate (referrer) reward. Friend and registration coupons keep their normal behavior because the filter that blocks new coupon creation removes itself immediately. ### Where does the customer see the growing amount? In their account under My Account, Refer a Friend. That coupon list reads the coupon amount live, so the new total appears automatically after each successful referral. --- ### How to test coupons with a recurring subscription? URL: https://wpgens.com/docs/how-to-test-coupons-with-a-recurring-subscription/ In order to test whether coupons get applied to recurring subscriptions, you need to have an account that has a subscription placed and is waiting for the next renewal – you can create a dummy subscription order and it should work. Use the referral link from that account in a new incognito window (or in a new browser) to make a new purchase so that the referrer can earn a coupon. When purchasing through a referral link, make sure that the email address and the street address are not used by another customer on the website as they need to be unique, or else the plugin will mark the order as a potential fraud to prevent abuse. If the order was made through the referral link successfully, you will see it in the box to the right, on the order screen. ![](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-How-to-test-coupons-with-recurring-subscription-data.png) Also, the user whose referral link was used should have a coupon available to them under the *My Account* page.  If everything is working as it should, go to Tools -> Scheduled Actions. Now you need to manually run renewal for the user that just got a coupon, to see that the coupon gets applied to their order. In order to find out which subscription ID you need to run, just find the ID of the dummy order you made with that account and that’s it. After clicking *run*, you should have a new order under the order screen and if you check the details of that order, you should see a coupon applied and that coupon will disappear from the My Account section.  --- Find out how you can benefit from [Using the WooCommerce Referral Plugin with WooCommerce Subscriptions](https://wpgens.com/using-a-referral-plugin-with-woocommerce-subscriptions/). --- ### How to use Contact Form 7 shortcode? URL: https://wpgens.com/docs/how-to-use-contact-form-7-shortcode/ Refer a friend comes with the Contact Form 7 shortcode [gens_raf]. The way it works is that it allows your users to send personalized messages via contact form 7 to their friends, and a referral link will show at the end of the email or where you place the shortcode in the email body. Usually, you want to create some page that will hold this form. At the top of the page, you can add some text like “Use this form to invite your friends, in exchange, every time they make a purchase, we will award you with the coupon”. Then below you would place the form.  The form needs to have a shortcode added in 2 places: **1. Inside Form Tab:** ![woocommerce refer a friend How to use Contact Form 7 shortcode? inside form tab](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-How-to-use-Contact-Form-7-shortcode-inside-form-tab.jpeg) **2. Inside Mail Tab:** ![woocommerce refer a friend How to use Contact Form 7 shortcode? inside email tab](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-How-to-use-Contact-Form-7-shortcode-inside-email-tab-1024x628.jpeg) This will ensure that once customer sends an email, it will be sent to his friend with custom message and subject. Make sure “To” is a friends email field.  This shortcode was introduced in the first version of Refer a friend before email sharing was an option. But its still powerful as it enables you to allow customers to add custom text which email sharing does not allow in current state. But thats also subject to change in one of the future patches. --- ### Installing & Quick Setup URL: https://wpgens.com/docs/installing-quick-setup/ To install and activate your WooCommerce Refer a friend PREMIUM plugin: - Go to [WPGens.com -> My Account -> Purchase History](https://wpgens.com/checkout/purchase-history/). - Click on the **view details link** and at the bottom, click on the link to download the plugin to your computer. - Next, go to your site:  **WordPress Admin > Plugins > Add New**. - Click **Upload Plugin** at the top. - Click on Choose File, select the .zip file you downloaded in step 2, and click **Install now.** - **Activate** the plugin. Before activating the plugin, if you are already using a free version, disable & remove it first or you will get a fatal error. Don’t worry, nothing will be erased. --- ### Installing and Configuring the Plugin URL: https://wpgens.com/docs/webflow-blog-sync/installing-and-configuring-the-plugin/ The Webflow Blog Sync plugin lets you sync WordPress blog posts to your Webflow CMS. To get started: ## Step 1: Install the Plugin - Go to your WordPress admin panel. - Navigate to **Plugins > Add New**. - Click **Upload Plugin**, select the plugin ZIP file, and click **Install Now**. - Once installed, click **Activate**. ## Step 2: Access Plugin Settings - Go to **Settings > Webflow Sync** to open the configuration screen. ## Step 3: Enter Required Information You’ll need to provide the following details: - **Webflow API Token** - **Webflow Site ID** - **Webflow Collection ID** These are required for the plugin to communicate with your Webflow CMS. --- ### Limit the maximum number of coupons/referrals a user can earn URL: https://wpgens.com/docs/limit-the-maximum-number-of-coupons-referrals-a-user-can-earn/ **READ FIRST:** This code works on the 2.0+ version of a plugin. Also, this code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If for some reason you want to limit the number of coupons one user can earn via the WooCommerce Refer a Friend plugin, add the code below to functions.php file. Of course, change the “20” in the code to the number of your choice. ``` function gens_limit_number_of_coupons($raf_info,$order,$referrer_id) { $num_referrals = intval(get_user_meta($referrer_id, "gens_num_friends", true)); if($num_referrals > 20) { $raf_info = array("info" => "User has reached maximum number of referred customers.", "generate" => "false", "increase_referrals" => "false"); } return $raf_info; } add_filter( 'gens_raf_order_info', 'gens_limit_number_of_coupons',10,3); ``` If you would like to hide the referral link after this, add this code, as well: ``` add_filter('wpgens_raf_link','gens_raf_link',10,3); function gens_raf_link($raf_link, $referral_id, $type) { $user_id = get_current_user_id(); $num_referrals = intval(get_user_meta($user_id, "gens_num_friends", true)); if($num_referrals > 20) { return "You have reached maximum number of customers you can refer."; } return $raf_link; } ``` --- ### Make referral links work for a specific product or category of products URL: https://wpgens.com/docs/make-referral-links-work-for-a-specific-product-or-category-of-products/ **READ FIRST:** Code is updated for plugin version 2.0! Also, this code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to restrict the referral link to work only when purchasing a specific product, add the code below to functions.php file. Of course, change “12345” to your product ID: ``` function only_specific_product($raf_info,$order,$referrer_id) { $items = $order->get_items(); $enable_referral = "no"; foreach ( $items as $item ) { $product_id = $item['product_id']; if($product_id == "12345") { $enable_referral = "yes"; } } if($enable_referral === "no") { $raf_info = array("info" => "Specific product wasnt in the cart, referral wont be generated.", "generate" => "false", "increase_referrals" => "false"); } return $raf_info; } add_filter( 'gens_raf_order_info', 'only_specific_product',10,3); ``` And if you want to restrict a referral link to work only when purchasing a product from a specific category, add the code below to functions.php file. Just make sure to change “12345” to your product category ID: ``` function wpgens_only_specific_cat($raf_info,$order,$referrer_id) { $items = $order->get_items(); $enable_referral = "no"; foreach ( $items as $item ) { $product_id = $item['product_id']; $term_list = wp_get_post_terms($product_id, 'product_cat', array('fields' => 'ids')); if (is_array($term_list) && in_array("add_your_cat_id_here", $term_list)) { $enable_referral = "yes"; } } if($enable_referral === "no") { $raf_info = array("info" => "Specific category wasnt in the cart, referral wont be generated.", "generate" => "false", "increase_referrals" => "false"); } return $raf_info; } add_filter( 'gens_raf_order_info', 'wpgens_only_specific_cat',10,3); ``` --- ### Mapping WordPress Categories to Webflow URL: https://wpgens.com/docs/webflow-blog-sync/mapping-wordpress-categories-to-webflow/ To ensure posts are synced to the right categories in Webflow: - Go to **Posts > Categories** in your WordPress admin. - Edit the category you want to sync. - Enter the corresponding **Webflow Category ID** into the provided field. Incorrect or missing category IDs may result in a “Bad Request” error during sync. --- ### Remove empty button that appears in Flatsome themes URL: https://wpgens.com/docs/remove-empty-button-that-appears-in-flatsome-themes/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! Some themes such as Flatsome do not follow WooCommerce standards regarding tabs, so it happens to make the log out button empty. If this happens to you, as well (as shown in the image below), read below how to fix it. ![woocommerce refer a friend Remove empty button that appears in Flatsome themes](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-Remove-empty-button-that-appears-in-Flatsome-themes-1024x338.png) You need to add this code to your functions.php file: ``` // Remove extra empty button for WPGens Refer a friend add_action('wp','wpgens_custom_account_tabs'); function wpgens_custom_account_tabs(){ $gens_plugin = WPGens_RAF::instance(); remove_filter( 'woocommerce_account_menu_items', array($gens_plugin->my_account,'gens_account_menu_item'),10); add_filter( 'woocommerce_account_menu_items', 'wpgens_account_menu_item',10,1 ); } function wpgens_account_menu_item( $items ) { $items['myreferrals'] = __( 'Refer a Friend', 'gens-raf' ); return $items; } ``` And that’s it. --- ### Saving Shared Emails URL: https://wpgens.com/docs/saving-shared-emails/ This guide provides code to save emails shared through the WPGENS RAF (Refer a Friend) plugin. You can add this code to your theme’s functions.php file. Instructions: 1. Open your theme’s functions.php file. You can do this through the WordPress admin panel under Appearance > Theme Editor, or via FTP. 2. Copy and paste the following code at the end of your functions.php file: ``` // Save RAF shared emails function save_raf_shared_emails($type, $data) { if ($type === 'email_share') { $shared_emails = get_option('raf_shared_emails', array()); $shared_emails[] = array( 'email' => $data['email'], 'name' => $data['name'], 'user_id' => $data['user'], 'date' => current_time('mysql') ); update_option('raf_shared_emails', $shared_emails); } } add_action('new_raf_data', 'save_raf_shared_emails', 10, 2); // Retrieve saved RAF emails function get_raf_shared_emails() { return get_option('raf_shared_emails', array()); } // Optional: Add a shortcode to display saved emails function display_raf_shared_emails_shortcode() { $shared_emails = get_raf_shared_emails(); $output = ' '; foreach ($shared_emails as $email_data) { $output .= '- ' . esc_html($email_data['email']) . ' - ' . esc_html($email_data['date']) . ' '; } $output .= ' '; return $output; } add_shortcode('raf_shared_emails', 'display_raf_shared_emails_shortcode'); ``` - Save the functions.php file. Usage: - The code will automatically save shared emails to the WordPress database. - To retrieve saved emails in your PHP code, use: `$emails = get_raf_shared_emails();` - To display saved emails on a page or post, use the shortcode: [raf_shared_emails] --- ### Show a custom message at the checkout when user has unused coupons URL: https://wpgens.com/docs/show-a-custom-message-at-the-checkout-when-user-has-unused-coupons/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to show a custom message at the checkout for users who have unused coupons they received from referring people, add this code to functions.php file: ``` add_action('woocommerce_before_checkout_form', 'show_referral_coupons_message'); function show_referral_coupons_message() { $userId = get_current_user_id(); if($userId === 0) { return; } $user_info = get_userdata(get_current_user_id()); $user_email = $user_info->user_email; $args = array( 'posts_per_page' => 99, 'post_type' => 'shop_coupon', 'post_status' => 'publish', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'customer_email', 'value' => $user_email, 'compare' => 'LIKE' ) ) ); $coupons = get_posts( $args ); if(empty($coupons)) { return; } $availableCoupons = []; foreach($coupons as $coupon) { $couponUsage = get_post_meta($coupon->ID,'usage_count', true); $usageLimit = get_post_meta($coupon->ID,'usage_limit', true); if($couponUsage < $usageLimit || $usageLimit === '') { array_push($availableCoupons, $coupon); } } if(!empty($availableCoupons)) { wc_print_notice( __('You have unused referral coupons. Add them to get a discount.'), 'notice' ); } } ``` --- ### Show Referral link and social icons on the Orders Thank You page URL: https://wpgens.com/docs/show-referral-link-and-social-icons-on-the-orders-thank-you-page/ ![](https://wpgens.com/wp-content/uploads/2024/06/image-1024x832.jpg) **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to show customers a referral link with a social sharing option on the Thank you page after they make an order, under displays settings, turn on the option to show the referral code on the thank you page, and also turn on the option to show within the modal. If you are using an older version of the plugin, before version 4.1.0, you can update a plugin or add a snippet from below. ``` // Show shortcode in the thank you page function show_referral_link(){ echo "Refer a friend Refer a friend and earn rewards. "; echo do_shortcode('[WOO_GENS_RAF_ADVANCE guest_text="Text to show when user is not logged in"]'); } add_action('woocommerce_thankyou','show_referral_link'); ``` Of course, don’t forget to change guest_text shortcode parameters, which is the text that will appear to customers who are not logged in.  If you are using the guest feature, add the code below to functions.php, as well. This will allow your customers to get referral links without adding their email again. ``` add_action('woocommerce_checkout_update_order_meta', 'saveOrderEmail'); function saveOrderEmail($order_id){ $order = new WC_Order( $order_id ); $user_email = ( version_compare( WC_VERSION, '2.7', ' --- ### Show referral link to admins only – for testing URL: https://wpgens.com/docs/show-referral-link-to-admins-only-for-testing/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to test the program before pushing it to the public, add this code below. ``` add_filter('wpgens_raf_code','gens_raf_code',10,1); function gens_raf_code($raf_code) { if( !current_user_can('manage_options')) { return 'Referral code is available only to Editors'; } return $raf_code; } add_filter('wpgens_raf_link','gens_raf_link',10,3); function gens_raf_link($raf_link, $referral_id, $type) { if( !current_user_can('manage_options')) { return 'Referral link is available only to Editors'; } return $raf_link; } add_action('wp','wpgens_custom_account_tabs'); function wpgens_custom_account_tabs(){ if( !current_user_can('manage_options')) { $gens_plugin = WPGens_RAF::instance(); remove_filter( 'woocommerce_account_menu_items', array($gens_plugin->my_account,'gens_account_menu_item'),10); } } ``` After you are done testing, remove the code and the program will be public. --- ### Step-by-Step: Setting Up Your Points & Rewards Program URL: https://wpgens.com/docs/loyalty-program/step-by-step-setting-up-points-and-rewards-program/ Whether you’re launching a loyalty program for the first time or setting one up on a new store, this guide walks you through every essential step using the WPGens Points and Rewards plugin for WooCommerce. ## Step 1: Activate the Points Program - Go to **Points & Rewards > Setup**. - Under **Program Status**, enable the loyalty program. ![WPGens Points and Rewards for WooCommerce - Program status](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Program-status.gif) When active: customers will earn and redeem points based on your settings. When disabled: points features are paused, but your settings are saved. ## Step 2: Enable Test Mode (Optional but Recommended) Test Mode lets you try out your entire program as an admin – without exposing it to real customers. To activate Test Mode: - Go to** WooCommerce > Points & Rewards**. - Locate the **Test Mode** toggle in the bottom left corner. - Toggle **Test Mode** on. ![WPGens Points and Rewards - Test mode](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Test-mode.gif) > While active: - Only site administrators can earn or redeem points. - Points UI is hidden from customers. - Ideal for safely testing rewards, display settings, and email flows. ## Step 3: Set Your Points Conversion Rate - Go to **Points & Rewards > Setup**. - In the **Points to Currency Conversion** section, set your conversion rate. Example: `10 Points = $1.00` - Optional: **Minimum Points Required**: Prevent low-value redemptions. - **Maximum Points Allowed**: Limit how many points can be used per order. - Enable **Include Shipping** to allow points to discount shipping fees. This setting determines how much value customers get when redeeming points at checkout. ![WPGens Points and Rewards - Shipping discount](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Shipping-discount.gif) ## Step 4: Create Earning Actions - Navigate to **Points & Rewards > Setup > Ways to Earn**. - Enable or customize built-in actions such as: **Place Order** (e.g., 1 point per $1) - **Registration** - **Product Review** - **Facebook / Instagram / TikTok Follow** - To add a custom action: Click **Add earning action** - Select an action type, give it a title, assign points, and enable it. ![WPGens Points and Rewards - Add Earning Action](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Add-Earning-Action.png) These actions define how and when customers earn loyalty points. ## Step 5: Set Up Redemption Rewards - Go to **Setup > Ways to Redeem**. - Click **Add redemption action**. - Set the reward: **Title** (e.g., “10% Off”) - **Points Cost** (e.g., 40 points) - Choose a **Coupon Type**: fixed, percentage, product-based, or free shipping - Add optional rules: **Minimum Spent** - **Coupon Duration** - **Included/Excluded Products or Categories** - **Reward Prefix** for unique coupon codes ![WPGens Points and Rewards - Add Redemption Action](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-Add-Redemption-Action.png) Customers will redeem points in exchange for these rewards via coupon codes at checkout. ### Optional: Import Starting Points for Existing Customers - Go to **Points & Rewards > Members**. - Click **Import Points**. - Upload a CSV in the format: `email,points` Example: `customer@example.com,150` - Choose whether to: **Add to existing points** - **Replace existing points** - Click **Import** to apply. Imported points immediately appear in the customer’s balance and history. Only use this step if you’re migrating from another system or giving customers a launch bonus. ## Step 6: Frontend display You can control how points and rewards are presented throughout your store, including the cart, checkout, and product pages. These settings help you tailor the experience to match your brand and optimize customer engagement. - Go to **Points & Rewards > Frontend Display** in your WordPress dashboard. - Under **Points Branding**, set the **singular and plural name** for your points (e.g., “Point” / “Points”) to match your store’s tone. - In the **Product Page** section: Enable **Show Points Earning Above Product Price** to display how many points a customer can earn on each product. - Customize the **Points Earning Template** using dynamic tags like: `{{points}}` – The number of points earned - `{{points_label}}` – Automatically outputs “Point” or “Points” - `{{product_price}}` – Displays product price with currency - In the **Points Redemption Form** section: Choose whether to **hide the form when balance is zero**. - Enable **Auto Open** if you want the redemption form to open by default on checkout. - Note: The redemption form appears in the **order review section** if points conversion is enabled and the user has redeemable points. - In the **Points Earning Box** section: Enable **Show Points Earning** to display earned points on the **cart page (non-block carts only)** and the **order review section** at checkout. - Click **Save Settings** after configuring each section. ![WPGens Points and Rewards for WooCommerce - Points Branding](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-Branding.png) **Tip: **These settings help customers see the value of engaging with your store. Make sure to preview them on both the product and checkout pages to ensure everything looks right with your theme. ## Step 7: Customize Landing Page Branding You can personalize the Points & Rewards landing page to match your brand and guide customers through earning and redeeming points. - Go to **Points & Rewards > Display Settings** in your WordPress dashboard. - Scroll to the **Points Page Customization** section. - Customize the following fields: **Primary Color** – This color will be applied to buttons, tabs, costs, and icons on the points page. - **Title** – The main heading shown at the top of the points page (e.g., “Earn & Redeem Points”). - **Subtitle** – A short description to help customers understand the purpose of the points program. - Copy the shortcode **`[WPGENS_POINTS_PAGE]`** and paste it on any page where you want to display the full Points & Rewards landing page. The page will automatically show in the **My Account** tab if placed correctly. - Click **Save Settings**. ![WPGens Points and Rewards for WooCommerce - Landing page](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Landing-page.gif) **Tip:** You can also use the Points Page block if you’re using the Gutenberg editor to place the landing page more visually. ## Step 8: Enable Points Expiration (Optional) - Go to **Points & Rewards > Settings**. - Scroll to **Points Expiration** and enable it. - Set an expiration period in days (e.g., 365). This adds urgency and helps keep your loyalty program engaging over time. ![WPGens Points and Rewards for WooCommerce - Points expiration](https://wpgens.com/wp-content/uploads/2025/04/WPGens-Points-and-Rewards-for-WooCommerce-Points-expiration.png) ## Step 9: Set Up Email Notifications - Go to **Points & Rewards > Emails**. - Configure the two available automated emails: **Points Expiry Warning Email** – Sent 30 days before points expire - **Reward Redeemed Email** – Sent when a customer redeems a reward - Customize: Subject, logo, and body image - Email body text using dynamic tags (e.g. `{{user_name}}`, `{{points_balance}}`) - Button text, link, and color scheme - Send a test email before activating. ![](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Automated-Email-Notifications.gif) Setting up emails keeps your customers informed and builds engagement with timely notifications. ## Step 10: (Optional) Connect to Klaviyo for Marketing Automation - Go to **Points & Rewards > Integrations**. - Enable **Klaviyo Integration** and enter your **Private API Key**. - The plugin syncs: Current points balance - Last points update - Use synced data to: Create segments for high-value customers - Trigger automated flows for expiring points - Personalize email campaigns ![WPGens Points and Rewards for WooCommerce - Klaviyo Integration](https://wpgens.com/wp-content/uploads/2025/03/Points-and-Rewards-for-WooCommerce-Klaviyo-Integration.gif) Use Klaviyo’s synced data to create targeted email flows, such as reminding customers when their points are about to expire, welcoming them when they first earn points, or offering exclusive rewards to your most loyal shoppers. This allows you to engage customers at the right time with the right message based on their real loyalty behavior. --- Setting up a points and rewards program doesn’t have to be complicated—and now, it isn’t. With just a few steps, you’ve created a system that encourages repeat purchases, builds customer loyalty, and gives shoppers a reason to keep coming back. As your store grows, you can fine-tune earning and redemption rules, personalize email communication, and even connect to marketing tools like Klaviyo to take your loyalty strategy further. Need to test or tweak anything? You can always re-enable Test Mode and make adjustments without impacting live customers. You’re in full control – now go reward your customers for choosing you. --- ### Stop coupon creation and email sending URL: https://wpgens.com/docs/stop-coupon-creation-and-email-sending/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! If you want to create your own function to run after the order is completed, or for some reason, you don’t need the creation of a coupon, add this code to your functions.php file and it will prevent the creation of referral coupons and sending of emails.  ``` add_action( 'wp_loaded', 'wpgens_override' ); function wpgens_override(){ $gens_plugin = WPGens_RAF::instance(); remove_action( 'woocommerce_order_status_completed', array( $gens_plugin->order_object, 'gens_maybe_create_send_coupon' ), 10 ); } ``` After that, maybe you want to call the coupon sending and creation within your function, which you could do with the following code, by passing the order ID: ``` $gens_plugin = WPGens_RAF::instance(); $gens_plugin->order_object->gens_maybe_create_send_coupon(734); ``` That’s it. --- ### TeraWallet support URL: https://wpgens.com/docs/terawallet-support/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! In order for referral coupons to work with Wallet Coupons add-on for TeraWallet, just add code below to the functions.php file: ``` add_action( 'gens_generate_user_coupon', function($couponId) { update_post_meta( $couponId, '_is_coupon_cashback', 'yes' ); }, 10, 1); ``` If you want to add amount directly to TeraWallet, the code below should do that for you. Also please note, this code works with fixed amount reward, not percentage. ``` // Add wallet credit add_action('gens_before_generate_user_coupon', function($user_id, $type, $order) { $amount = get_option($type === "friend" ? 'gens_raf_friend_coupon_amount' : 'gens_raf_coupon_amount'); // Add to TeraWallet if (function_exists('woo_wallet')) { woo_wallet()->wallet->credit($user_id, $amount, 'Referral Reward'); } }, 10, 3); // Prevent coupon generation add_filter('gens_raf_generate_coupon', function($generate, $order_id) { // Return false to prevent coupon generation return false; }, 10, 2); ``` --- ### WooCommerce 9.8.1 bug URL: https://wpgens.com/docs/woocommerce-9-8-1-bug/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! WooCommerce 9.8 introduced a bug where lots of WooCommerce admin analytics script are loaded on every page of WordPress, which affects whole backend, unfortunately it also affects all plugins with React backend, we sent a fix to WooCommerce team here [https://github.com/woocommerce/woocommerce/issues/57147](https://github.com/woocommerce/woocommerce/issues/57147) .It will be resolved in the next WooCommerce update, until then, please add this code to functions.php to make our plugins backend start working again. ``` add_filter('woocommerce_navigation_is_connected_page', function ($is_connected, $page_id) { $currentScreen = get_current_screen(); $screenID = $currentScreen->id; if ($screenID === "woocommerce_page_gens-raf" || $screenID === "woocommerce_page_wpgens-points-program" || $screenID === "marketing_page_wpgens-utm-tracking" || $screenID === "marketing_page_wpgens-st") { return true; } return $is_connected; }, 10, 2); ``` As soon as WooCommerce sends new update, you should remove this code. Sorry for the inconvinence but this error affects every plugin that has React running in the background. Also, if you see currently your WordPress backend a bit slower than usual, this is the reason. --- ### WooCommerce Points & Rewards, how to reward users with points instead of a coupon? URL: https://wpgens.com/docs/woocommerce-points-rewards-how-to-reward-users-with-points-instead-of-a-coupon/ If you are using the Woocommerce Points and Rewards plugin, you can reward users for referring friends with points instead of a coupon. To do so, go to the Points and Rewards plugin settings and change the number of points under the “Points earned for referring a user”. ![](https://wpgens.com/wp-content/uploads/2023/11/WooCommerce-Refer-a-Friend-WooCommerce-Points-Rewards-how-to-reward-users-with-points-instead-of-a-coupon-rewards-1024x304.jpeg) After that, if you want to stop generating coupons, add the code below to functions.php file: ``` add_filter( 'gens_raf_generate_coupon', '__return_false' ); ``` And that’s it! --- ### WooCommerce Refer a Friend Shortcodes URL: https://wpgens.com/docs/refer-a-friend-shortcodes/ WooCommerce Refer a Friend supports 2 types of shortcodes you can use to show a referral link to your customers: - Simple shortcode - Advanced shortcode ## Simple shortcode The simple shortcode:  [WOO_GENS_RAF] will show just a referral link for users who are logged in. Use the URL parameter in the shortcode to link to some other page – by default, it’s set to the homepage. ## Advanced Shortcode The advanced shortcode comes with social icons and email shareability: ![](https://wpgens.com/wp-content/uploads/2024/04/raf-ui-2.jpg) This is the shortcode you can use: ``` [WOO_GENS_RAF_ADVANCE guest_text='Please login [here](login_url) to access your referral link.'] ``` In general, you want to create a landing page that will have a piece of text explaining the benefits of the referral system, then include a shortcode below it. The shortcode will show only for logged-in users, while for guests, you can define which message to show as a parameter – as you can see in the shortcode example above. You can pass url=” parameter if you want referral link to land on specific page. ## Full Shortcode to replicate My Account Page Some custom themes do not use WooCommerce built-in filters, so sometimes you need to add a custom tab with the content. In that case, Refer a friend tab on the *My account* page will not show and you need to use **[WOO_GENS_RAF_FULL]** shortcode to replicate the My Account page. ## Contact Form 7 Shortcode Check [this article](https://wpgens.com/docs/how-to-use-contact-form-7-shortcode/) that explains the usage of Contact Form 7.[](https://wpgens.com/docs/refer-a-friend-shortcodes/#betterdocs-form-modal) --- ### WooCommerce Subscription – recurring rewards URL: https://wpgens.com/docs/woocommerce-subscription-recurring-rewards/ **READ FIRST:** This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven’t done this before, adding this code in the wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help! By default, if a customer refers someone, they will receive a single coupon as a reward. However, if you want to keep rewarding a customer as long as the referral is renewing their subscription, you can do so by adding the code below to your functions.php file: ``` remove_filter( 'wcs_renewal_order_meta_query', 'gens_prevent_referral_copying', 10, 3 ); ``` If you add this code, every time the referral pays the subscription, the customer will receive a new coupon, which means that they will be receiving rewards as long as their referral is renewed. --- To learn more about recurring rewards check out our article: [Using a Referral Plugin with WooCommerce Subscriptions](https://wpgens.com/using-a-referral-plugin-with-woocommerce-subscriptions/) --- ### WooCommerce Subscriptions – apply coupons on next renewal URL: https://wpgens.com/docs/woocommerce-subscriptions-apply-coupons-on-next-renewal/ Refer a Friend is compatible with the WooCommerce Subscriptions plugin. To make it work, after setting up the plugin per the step-by-step guide you can find on this link: [Setting up WooCommerce Refer a Friend plugin](https://wpgens.com/docs/general-settings/#2-toc-title), you need to enable the WooCommerce subscription option under the plugin’s general settings and you are done – coupons will be automatically applied to customers on their next payment. ![WooCommerce Subscriptions - apply coupons on next renewal ](https://wpgens.com/wp-content/uploads/2023/12/image-5-1024x454.png) So, once your customer has referred a friend to your store and earned a coupon, that coupon value will be automatically deducted from their next renewal. If the amount of the coupon equals the subscription price, their renewal will be free. Giving 1 free month (or whatever subscription period you have) in exchange for getting a new person signed up is a great way to increase your site subscription base. This feature works with payment gateways that support recurring total modifications. Read more about them here: [https://docs.woocommerce.com/document/subscriptions/payment-gateways/#advanced-features](https://docs.woocommerce.com/document/subscriptions/payment-gateways/#advanced-features) --- ### WPML Translation URL: https://wpgens.com/docs/wpml-translation/ WPML Translation should be pretty straightforward to set up. - You need to log in to your site, go to WPML -> String Translation - From the domains dropdown choose gens-raf and translate. You can read a fully detailed explanation on the WPML site [here](https://wpml.org/documentation/getting-started-guide/theme-localization/). ![woocommerce refer a friend wpml translation](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-wpml-translation-1024x449.png) After you finish these translations, there are some that will be missing, and those are the strings that appear in the emails. In order to translate those, go to WPML -> String Translation, scroll down to the bottom of the page, and click on the link “Translate texts in admin screens »”. Next, scroll through that page to find the missing strings, tick the checkbox, and click Apply to add it to the String Translation table. Now you can go back to WPML -> String Translation and you should see the strings added there. ![woocommerce refer a friend wpml string translation](https://wpgens.com/wp-content/uploads/2023/11/woocommerce-refer-a-friend-wpml-string-translation-1024x844.png) One thing to note is that when marking an order as complete, WordPress sends the coupon code email in the language that is set for the admin screen.  --- ## UTM Tracking for WooCommerce ### Activating Your License & Updates URL: https://wpgens.com/docs/utm-tracking/activating-your-license-and-updates/ A valid license key lets your store receive automatic plugin updates with the latest features and fixes. ## Activate your license - Go to **Marketing > UTM Tracker > Settings** and open the license section. - Enter the **Licence Key** you received by email when you purchased the plugin. - Save to activate. When successful you will see *License key is valid.* ## Receiving updates Once the license is active, new versions appear under **Dashboard > Updates** and on the Plugins screen, just like any other plugin. Keeping the plugin updated ensures compatibility with the latest WordPress and WooCommerce releases. ## Moving to another site A license is tied to the site where it is activated. If you need to move it, use **Deactivate Site** first, then activate the key on the new site. If you see *Your license is not active for this URL*, the key is currently registered to a different domain. --- ### Building Campaign URLs with the Link Builder URL: https://wpgens.com/docs/utm-tracking/building-campaign-urls-with-the-link-builder/ The **UTM Link Builder** helps you create correctly tagged campaign links without typing parameters by hand. Find it in **Marketing > UTM Tracker > UTM Link Builder**. ## Building a link - **Website URL** – enter the destination address for your campaign (for example a product or landing page). - **Source** – identify where the traffic comes from, e.g. `google`, `facebook`, `newsletter`. - **Medium** – identify the channel, e.g. `cpc`, `email`, `social`, `banner`. - **Campaign** – name the specific campaign, e.g. `summer-sale`. - **Content** (optional) – tell similar links apart, e.g. `logolink` vs `textlink`. - Click **Generate URL**. Your tagged link appears, ready to **Copy URL**. ## Using your link Paste the generated URL into your ad, email, social post, or anywhere else you promote your store. When visitors click it, the source, medium, campaign, and content are captured automatically and attached to any order they place. ## Tips for consistent reports - Use lowercase values and stick to one spelling. `Facebook` and `facebook` are counted separately. - Pick a small, fixed set of mediums (for example cpc, email, social) and reuse them everywhere. - Keep campaign names descriptive and dated, e.g. `2026-summer-sale`. --- ### First Touch vs Last Touch URL: https://wpgens.com/docs/utm-tracking/first-touch-vs-last-touch/ UTM Tracking records two attribution points for every customer. Knowing the difference helps you read your reports correctly. ## First Touch **First Touch** is how a customer *first* discovered your store. It is recorded the first time someone visits and is kept for up to 90 days. First Touch answers the question: “Which channel introduced this customer to us?” ## Last Touch **Last Touch** is the most recent way the customer arrived before placing the order. It is updated on each new visit. Last Touch answers the question: “Which channel actually closed this sale?” ## An example A shopper clicks a Facebook ad and discovers your store but does not buy. Two weeks later they search Google for your brand, return, and complete a purchase. - **First Touch:** Facebook / cpc – the ad earned the discovery. - **Last Touch:** Google / organic – the search closed the sale. If both touches are identical, the order screen simply notes “Same as first.” ## Conversion lag On the order screen you will also see **Conversion Lag**, the time that passed between the customer’s first visit and the moment they ordered. A long lag tells you customers take time to decide; a short lag points to impulse purchases. --- ### Frequently Asked Questions URL: https://wpgens.com/docs/utm-tracking/frequently-asked-questions/ ## Does this plugin require WooCommerce? Yes. UTM Tracking attaches source data to WooCommerce orders, so WooCommerce must be installed and active. ## Is it compatible with High-Performance Order Storage (HPOS)? Yes. The plugin fully supports HPOS as well as the classic order storage, so the Order Source box, the Source column, and reports all work either way. ## Do I need to add UTM parameters to every link? No. UTM parameters give you the most control, but when they are missing the plugin automatically detects organic, social, paid, referral, and direct traffic. Add UTM tags when you want precise campaign names and mediums. ## Does it slow down my site? No. Tracking runs from a lightweight script and stores the source in a first-party cookie. Nothing is sent to external services. ## Will it work with caching plugins? Yes. Source detection happens in the browser, so cached pages do not prevent tracking. The source is only written to the order at checkout, which is never cached. ## Can it track sales in multiple currencies? Yes. Revenue is handled correctly across currencies in the dashboard reports. ## What happens to data if I deactivate the plugin? Source data already saved on past orders remains in your database. New orders simply will not receive source data while the plugin is inactive. --- ### Getting Started with UTM Tracking URL: https://wpgens.com/docs/utm-tracking/getting-started-with-utm-tracking/ **UTM Tracking** by WPGens captures the marketing source of every visitor and links it to the WooCommerce orders they place. It shows you exactly which campaigns, channels, and links are driving sales, right inside your WordPress dashboard, without any external service. ## What you need - WordPress 5.9 or newer - WooCommerce 4.2 or newer (the plugin is fully compatible with High-Performance Order Storage) - PHP 7.4 or newer ## Step 1 – Install the plugin - Download the plugin **ZIP file** from your WPGens account. - In WordPress, go to **Plugins > Add New Plugin > Upload Plugin**. - Choose the ZIP file, click **Install Now**, then **Activate**. ## Step 2 – Add your license key A license key unlocks automatic updates. Open **Marketing > UTM Tracker > Settings**, paste the **Licence Key** you received by email, and save. See [Activating Your License & Updates](/docs/utm-tracking/activating-your-license-and-updates/) for details. ## Step 3 – Start tracking That’s it, there is nothing else to configure. As soon as the plugin is active it begins recording the traffic source of every visitor in a cookie. When a visitor checks out, that source is attached to their order automatically. ## Where to find your data - **Per order:** open any order to see its *Order Source* box, and add a *Source* column to the Orders list. - **Reports:** open **Marketing > UTM Tracker** for the full analytics dashboard. New to UTM parameters? Read [How UTM Tracking Works](/docs/utm-tracking/how-utm-tracking-works/) next. --- ### How Traffic Sources Are Detected URL: https://wpgens.com/docs/utm-tracking/how-traffic-sources-are-detected/ When a visitor arrives without UTM parameters in the link, the plugin works out where they came from automatically. This article explains how the source and medium are decided. ## UTM parameters always win If the link contains UTM parameters (for example `utm_source` and `utm_medium`), those values are used exactly as provided. Automatic detection only kicks in when UTM parameters are missing. ## The mediums the plugin assigns - **Organic** – the visitor came from a search engine such as Google, Bing, Yahoo, DuckDuckGo, Yandex, or Baidu. When available, the search term is captured too. - **Social** – the visitor came from a social network such as Facebook, Instagram, X/Twitter, LinkedIn, Pinterest, TikTok, YouTube, Reddit, or WhatsApp. - **CPC (paid)** – the link carried a paid-click identifier such as `gclid` (Google Ads), `fbclid` (Facebook), `msclkid` (Microsoft/Bing), or `wbraid`/`gbraid`. - **Referral** – the visitor came from another website that is not a search engine or social network. - **(Direct)** – there was no referring website, for example the visitor typed your address, used a bookmark, or clicked a link in an app that hides the referrer. ## Click identifiers from ad platforms Ad platforms append their own identifiers to your links. The plugin recognises and stores these so paid traffic is correctly marked as **cpc** even when you forget to add UTM tags: - **gclid / gclsrc / wbraid / gbraid** – Google Ads - **fbclid** – Facebook / Meta Ads - **msclkid** – Microsoft Advertising (Bing) ## Internal links Moving between pages on your own site does not overwrite the original source. The first real source a visitor arrived with is preserved throughout their session. --- ### How UTM Tracking Works URL: https://wpgens.com/docs/utm-tracking/how-utm-tracking-works/ This article explains the basic concepts behind UTM Tracking so the rest of the documentation makes sense. ## What is a UTM parameter? UTM parameters are small tags you add to the end of a link so analytics tools can tell where a visitor came from. For example: ``` https://yourstore.com/?utm_source=facebook&utm_medium=cpc&utm_campaign=summer-sale ``` The standard parameters are **utm_source**, **utm_medium**, **utm_campaign**, **utm_content**, and **utm_term**. You can build links like this with the built-in [UTM Link Builder](/docs/utm-tracking/building-campaign-urls-with-the-link-builder/). ## How the plugin records a source - A visitor lands on your store. The plugin reads any UTM parameters in the URL. - If there are no UTM parameters, it works out the source automatically from the referring website (for example a Google search or a Facebook post). See [How Traffic Sources Are Detected](/docs/utm-tracking/how-traffic-sources-are-detected/). - The source is stored in a cookie in the visitor’s browser, so it survives while they browse your site. - When the visitor places an order, the source from the cookie is saved permanently on that order. ## First touch and last touch The plugin remembers two things: the very first way a customer found you (**First Touch**) and the most recent way they arrived before buying (**Last Touch**). This shows you both what introduced a customer to your brand and what closed the sale. Read more in [First Touch vs Last Touch](/docs/utm-tracking/first-touch-vs-last-touch/). ## Privacy All tracking data stays on your own site. The plugin uses a first-party cookie and stores the result in your WordPress database, it does not send visitor data to any third party. --- ### Plugin Settings Explained URL: https://wpgens.com/docs/utm-tracking/plugin-settings-explained/ The plugin works out of the box, but you can fine-tune its behaviour under **Marketing > UTM Tracker > Settings**. This article covers the General settings. ## Disable UTM Tracking Completely Check this to switch tracking off entirely. While disabled, no visitor activity is recorded and no source data is added to new orders. Leave it unchecked for normal operation. ## Cookie Time (in days) How long the last-touch source is remembered in the visitor’s browser. A longer window keeps attribution alive for shoppers who return after a while; a shorter window credits only recent visits. The default suits most stores. ## Delete Cookie after Purchase If checked, the tracking cookie is cleared once a customer completes a purchase. This means their next visit is treated as a fresh journey rather than continuing the previous one. ## Excluded URLs from Reports Enter one URL or domain per line. Orders coming from these sources or referrers are still tracked but are hidden from your dashboard reports. This is useful for filtering out your own internal domains, staging sites, or partners you do not want skewing the data. ## Tracking Source (Reporting Method) Choose where attribution data comes from: - **WPGens Tracking (Default)** – the plugin’s own tracker, which records first and last touch plus the full set of fields described in this documentation. - **WooCommerce Order Attribution** – use the attribution data WooCommerce collects natively instead. Most stores should keep the default. Remember to click **Save** after changing any setting. --- ### The Order Source Box & Orders Column URL: https://wpgens.com/docs/utm-tracking/order-source-box-and-orders-column/ The fastest way to see where a single order came from is right on the order itself. ## The Order Source box ![](https://wpgens.com/wp-content/uploads/2026/06/image-1-scaled.png) Open any order under **WooCommerce > Orders**. In the right-hand column you will find an **Order Source** box with three sections: - **General** – Conversion Lag, First Referrer, and First Landing page. - **First Touch** – the full set of fields for how the customer first found you. - **Last Touch** – the fields for the visit that led to the order. If it is identical to First Touch, you will see “Same as first.” Only fields that were actually captured are shown. If something is missing, it was not present in the customer’s link or session. ## The Source column in the Orders list ![](https://wpgens.com/wp-content/uploads/2026/06/image-scaled.png) The Orders list (**WooCommerce > Orders**) gains a **Source** column showing each order’s last-touch source and medium at a glance, for example `google (organic)` or `facebook (cpc)`. This lets you scan many orders without opening each one. ## Works with High-Performance Order Storage Both the Order Source box and the Source column work whether your store uses the classic order storage or WooCommerce’s newer High-Performance Order Storage (HPOS). --- ### Tracked Data Fields Explained URL: https://wpgens.com/docs/utm-tracking/tracked-data-fields-explained/ For each order, UTM Tracking can store the following fields for both First Touch and Last Touch. If a field is empty it simply means that value was not present in the visitor’s link or session. ## Campaign fields - **Source** – where the traffic came from (e.g. google, facebook, newsletter). - **Medium** – the marketing channel (e.g. cpc, email, social, organic, referral). - **Campaign** – the specific campaign name you set (e.g. summer-sale). - **UTM Content** – distinguishes similar links or ads (e.g. logolink vs textlink). - **UTM Term** – the keyword, often the search term for organic traffic. ## Context fields - **Full Landing URL** – the complete address the visitor first opened, including all parameters. - **Landing Page** – the page path they arrived on. - **Visit Date** – when the visit happened (used to calculate conversion lag). - **Device Type** – desktop, mobile, or tablet. - **Browser** – the visitor’s browser (Chrome, Firefox, Safari, and so on). - **Google Analytics Client ID** – links the order to the visitor’s GA session when GA is installed. ## Click identifiers When present, the paid-click identifiers **gclid**, **fbclid**, and **msclkid** are stored as well, so you can match orders back to specific ad clicks in Google, Facebook, or Microsoft Advertising. All of these fields appear in the *Order Source* box on the order screen. See [The Order Source Box & Orders Column](/docs/utm-tracking/order-source-box-and-orders-column/). --- ### Troubleshooting URL: https://wpgens.com/docs/utm-tracking/troubleshooting-utm-tracking/ If tracking is not behaving as expected, work through the checks below. ## No source data on orders - Confirm the plugin is active and that **Disable UTM Tracking Completely** is *not* checked in Settings. - Place a test order yourself after visiting the store with UTM parameters in the URL, then open that order and check the *Order Source* box. - Make sure cookies are allowed in the browser you test with; tracking relies on a first-party cookie. ## Everything shows as “(Direct)” “(Direct)” means no referring website and no UTM parameters were detected. This is normal for typed addresses, bookmarks, and links opened from some apps that strip the referrer. To confirm detection works, visit your site through a tagged link from the [UTM Link Builder](/docs/utm-tracking/building-campaign-urls-with-the-link-builder/) and place a test order. ## Source looks wrong or duplicated Inconsistent values such as `Facebook` and `facebook` are counted separately. Standardise your UTM values, ideally by always generating links with the Link Builder. ## An order is missing from reports Check your **Excluded URLs from Reports** setting. Orders from excluded sources are still tracked but are deliberately hidden from the dashboard. Also confirm the report’s **Date Range** covers the order date. ## Still need help? If the problem persists, reach out to WPGens support with your store details and the steps you have tried, and we will help you get it sorted. --- ### Using the UTM Tracker Dashboard URL: https://wpgens.com/docs/utm-tracking/using-the-utm-tracker-dashboard/ The dashboard is where you analyse performance across all orders. Open it from **Marketing > UTM Tracker** in the WordPress admin. ![](https://wpgens.com/wp-content/uploads/2026/06/image-2-scaled.png) ## Campaign Reports The **Campaign Reports** screen summarises your sales by marketing source. At the top you will see headline metrics: - **Total Orders** - **Shop Revenue** - **Average Order Value** Below the metrics, your orders are broken down by **Campaign**, **Source**, **Referrers**, **Countries**, **Browsers**, **Top Landing Pages**, and date of visit, so you can quickly see what is working. ## Filtering reports - **Date Range** – choose the period you want to analyse. - **Report Filters** – narrow the data to a specific source, medium, campaign, and more. Active filters are listed so you always know what you are looking at. - **Reporting Method** – switch between WPGens tracking data and WooCommerce Order Attribution (see [Plugin Settings Explained](/docs/utm-tracking/plugin-settings-explained/)). ## Orders The **Orders** screen lists every order recorded since the plugin was activated, with its order ID, amount, and source details. Use the same date range and filters to drill down to the exact orders behind a number in your reports. ## Multi-currency If your store sells in more than one currency, revenue totals are handled correctly across currencies so your reports stay accurate. --- ## Webflow Blog Sync ### How the Sync Works URL: https://wpgens.com/docs/webflow-blog-sync/how-the-sync-works/ The plugin syncs WordPress blog posts to your Webflow CMS using the Webflow API. ## Sync Triggers: - When a post is **published** or **updated** in WordPress - Drafts are also synced as drafts in Webflow ## Content Synced: - **Title** - **Slug** - **Content (Rich Text)** - **Excerpt** - **Featured Image** - **Images in Content** - **Category** - **Reading Time** - **Post Date** Images are automatically uploaded to your Webflow asset library. ## Manually Re-syncing Posts If you make changes to a post after the initial sync: - You **must manually click Update** in WordPress to trigger a re-sync. - Automatic syncing of edits is not currently supported. --- ### How to Find Your Webflow Site ID and Collection ID URL: https://wpgens.com/docs/webflow-blog-sync/how-to-find-your-webflow-site-id-and-collection-id/ ## Finding Your Site ID: - Open your Webflow project. - Go to **Project Settings > General**. - Copy the **Site ID** from the General tab. ## Finding Your Collection ID: - In the Webflow Designer, go to **CMS Collections**. - Open your blog collection (e.g., Posts). - The **Collection ID** can be found in the collection settings or URL. --- ### How to Generate Your Webflow API Token URL: https://wpgens.com/docs/webflow-blog-sync/how-to-generate-your-webflow-api-token/ - Log in to your Webflow account. - Go to **Account Settings > Workspace Settings**. - Click on **API Access**. - Click **Generate New Token** and copy it. - Paste this token into the Webflow API Token field in the plugin settings. Make sure the token has access to CMS and Collection permissions. --- ### Installing and Configuring the Plugin URL: https://wpgens.com/docs/webflow-blog-sync/installing-and-configuring-the-plugin/ The Webflow Blog Sync plugin lets you sync WordPress blog posts to your Webflow CMS. To get started: ## Step 1: Install the Plugin - Go to your WordPress admin panel. - Navigate to **Plugins > Add New**. - Click **Upload Plugin**, select the plugin ZIP file, and click **Install Now**. - Once installed, click **Activate**. ## Step 2: Access Plugin Settings - Go to **Settings > Webflow Sync** to open the configuration screen. ## Step 3: Enter Required Information You’ll need to provide the following details: - **Webflow API Token** - **Webflow Site ID** - **Webflow Collection ID** These are required for the plugin to communicate with your Webflow CMS. --- ### Mapping WordPress Categories to Webflow URL: https://wpgens.com/docs/webflow-blog-sync/mapping-wordpress-categories-to-webflow/ To ensure posts are synced to the right categories in Webflow: - Go to **Posts > Categories** in your WordPress admin. - Edit the category you want to sync. - Enter the corresponding **Webflow Category ID** into the provided field. Incorrect or missing category IDs may result in a “Bad Request” error during sync. --- ### Required Webflow CMS Fields URL: https://wpgens.com/docs/webflow-blog-sync/required-webflow-cms-fields/ Ensure your Webflow collection includes these fields: Webflow FieldField TypeDescription`name`Plain textPost title`slug`Plain textURL slug`post-body`Rich textMain content`post-summary`Plain textExcerpt/summary`main-image`ImageFeatured image`thumbnail-image`ImageThumbnail image (optional)`reading-time`Plain textEstimated reading time`date`DatePost publication date`category`ReferenceReference field to category object Without these fields, syncing may fail or result in missing content. --- ### Troubleshooting Common Errors URL: https://wpgens.com/docs/webflow-blog-sync/troubleshooting-common-errors/ ## Error: Bad Request - Usually caused by a missing or incorrect Webflow Category ID. - Double-check your category mapping in WordPress. ## Error: Images Not Displayed in Webflow - Ensure Webflow CMS fields for images are correctly set up. - Check that uploaded images are in a supported format (JPG, PNG). ---