Skip to content

Version 2.1.0

Choose a tag to compare

@JRG-code JRG-code released this 13 Nov 11:29
· 45 commits to main since this release
bd4af82

Automatic Tier Sync:

  • Add cas_sync_tier_coupons() function in helpers.php
  • Automatically syncs all affiliate coupons when tier settings are saved
  • Updates coupon_amount and discount_type for all affiliates in the modified tier
  • Shows sync count in success message (e.g., "5 affiliate coupon(s) synced")
  • Fixes tier upgrade to use correct coupon discount (was using commission rate by mistake)

Manual Sync Button:

  • Add "Sync Now" button to top of affiliates table in Overview page
  • Button has refresh icon (dashicons-update) for visual clarity
  • Syncs all coupons across all tiers with their current tier settings
  • Shows success message with total count synced
  • Uses WordPress nonce for security

Tier Upgrade Fix:

  • Fix coupon update during tier upgrade to use tier's coupon_discount setting
  • Previously was incorrectly using commission_rate as coupon amount
  • Now properly gets coupon_discount and coupon_discount_type from tier settings

This ensures that:

  1. When you edit a tier's coupon settings, all existing affiliates' coupons update immediately
  2. Admins can manually sync all coupons if needed
  3. Tier upgrades properly apply the new tier's coupon settings
  4. Consistency is maintained between tier definitions and active coupons

Files modified:

  • includes/helpers.php: Add cas_sync_tier_coupons() function
  • admin/tier-management.php: Call sync after tier save, update success message
  • admin/overview.php: Add sync handler, Sync Now button, fix tier upgrade coupon logic