This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Earn Points Template - Custom Override with Newsletter Signup | |
| */ | |
| if (!defined('ABSPATH')) { | |
| exit; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('wpgens_loyalty_update_points', 'filter_points_by_user_role', 5, 6); | |
| function filter_points_by_user_role($user_id, $points_delta, $type, $source, $reference_id = null, $description = null) { | |
| // Define roles that should be excluded from points system | |
| $excluded_roles = ['wholesale_customer', 'restricted_user', 'employee']; | |
| // Get user object | |
| $user = get_userdata($user_id); | |
| if (!$user) { | |
| return false; // User not found |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Klaviyo Integration | |
| */ | |
| class WPGL_Klaviyo | |
| { | |
| private static $instance = null; | |
| const INTEGRATION_KEY = 'klaviyo'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Hook into checkout | |
| * | |
| * @since 2.0.0 | |
| */ | |
| if (!defined('ABSPATH')) { | |
| exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add this to your main plugin file or in a hooks class | |
| add_filter('woocommerce_coupon_is_valid', 'prevent_coupons_when_points_applied', 10, 3); | |
| function prevent_coupons_when_points_applied($is_valid, $coupon, $discount_object) { | |
| // Skip validation for loyalty points coupons themselves | |
| if (strpos($coupon->get_code(), 'loyalty_points_') === 0) { | |
| return $is_valid; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Handles points redemption during checkout process | |
| */ | |
| class WPGL_Points_Checkout | |
| { | |
| private static $instance = null; | |
| const COUPON_PREFIX = 'loyalty_points_'; | |
| const EXPIRATION_TIME = 3600; // 1 hour in seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class WPGL_Points_API | |
| { | |
| private static $instance = null; | |
| public static function init() | |
| { | |
| if (self::$instance === null) { | |
| self::$instance = new self(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Handles points redemption during checkout process | |
| */ | |
| class WPGL_Points_Checkout | |
| { | |
| private static $instance = null; | |
| const COUPON_PREFIX = 'loyalty_points_'; | |
| const EXPIRATION_TIME = 3600; // 1 hour in seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('wpgens_raf_new_user_referral_id', 'send_referral_to_mailchimp', 10, 2); | |
| function send_referral_to_mailchimp($referral_id, $user_id) { | |
| $user = get_userdata($user_id); | |
| if (!$user) { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| document.addEventListener('DOMContentLoaded', function () { | |
| document.querySelectorAll('.wpgens-raf-simple-shortcode').forEach(function (el) { | |
| el.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| const textToCopy = el.href; | |
| navigator.clipboard.writeText(textToCopy).then(() => { | |
| const originalText = el.textContent; |