OTSLR Sync Coupons
WordPress plugin to sync coupons between Memberpress and WordPress
by Philip Rudy · github.com/milliephanillie/otslr-sync-coupons
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/milliephanillie/otslr-sync-coupons/archive/refs/heads/main.zipWordPress plugin that syncs coupons between MemberPress and WooCommerce.
Description
When a coupon is created or updated in MemberPress, this plugin automatically mirrors it to WooCommerce by hooking into the mepr-coupon-save-meta action. It compares discount amount, type, and expiration to determine whether the WooCommerce coupon needs to be created or updated.
Requirements
- PHP 7.4+
- WordPress
- MemberPress
- WooCommerce
Installation
- Copy the plugin to
wp-content/plugins/otslr-sync-coupons/ - Run
composer installin the plugin directory - Activate the plugin in WordPress admin
Plugin Structure
otslr-sync-coupons/
├── otslr-sync-coupons.php # Main plugin entry point
├── composer.json
├── src/
│ ├── Includes/
│ │ └── OtslrWooCoupon.php # Coupon sync logic (MemberPress → WooCommerce)
│ └── Routes/
│ └── OtslrScRoutes.php # REST API routes (WIP)
How It Works
The plugin listens on the MemberPress mepr-coupon-save-meta hook. When a MemberPress coupon is saved, OtslrWooCoupon::sync_coupon() is called with the full MeprCoupon object. The plugin then:
- Looks up the coupon code in WooCommerce
- If it exists, updates the matching WooCommerce coupon
- If it doesn't exist, creates a new
WC_Couponwith the synced values
License
GPL-2.0-or-later