=== Conditional Email Tags for Easy Digital Downloads === Contributors: misulicus Tags: edd, easy digital downloads, email tags, conditional logic, email templates Requires at least: 6.2 Tested up to: 6.8 Requires PHP: 7.4 Stable tag: 1.0.3 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html 🎯 Add powerful conditional logic to your Easy Digital Downloads email templates! == Description == Conditional Email Tags for Easy Digital Downloads lets you add smart, dynamic content to your EDD email templates using simple `{if ...}{/if}` tags. Personalize your customer emails based on payment gateway, order price, user role, and more! **Examples:** - `{if gateway="stripe"}This is only for Stripe payments.{/if}` - `{if gateway="paypal" price=">50"}PayPal and price over $50!{/if}` - `{if user_role="subscriber"}Hello, valued subscriber!{/if}` - `{if tax=">10"}This order has significant tax.{/if}` - `{if discount_codes="SUMMER20"}Special summer discount applied!{/if}` **Why use this plugin?** - 🧠 Make your emails smarter and more relevant - 🛒 Target messages by payment method or order value - 👤 Personalize content for different user roles - 🔌 Easily extensible for developers - More to come! == Installation == 1. Upload the plugin files to the `/wp-content/plugins/edd-conditional-email-tags/` directory, or install through the WordPress plugins screen. 2. Activate the plugin through the 'Plugins' menu in WordPress. 3. Edit your EDD email templates and use `{if ...}{/if}` tags as needed. == Usage == Add conditional blocks to your EDD email templates. Here are working examples for all available conditions: **1. By Gateway** - Only for Stripe payments: `{if gateway="stripe"}This is only for Stripe payments.{/if}` - Only for PayPal payments: `{if gateway="paypal"}This is only for PayPal payments.{/if}` **2. By Price** - Order total greater than $50: `{if price=">50"}Shown if order total is greater than $50.{/if}` - Order total less than or equal to $20: `{if price="<=20"}Shown if order total is $20 or less.{/if}` - Order total exactly $100: `{if price="100"}Shown if order total is exactly $100.{/if}` **3. By Tax** - Order tax greater than $10: `{if tax=">10"}This order has significant tax.{/if}` - Tax-free purchase: `{if tax="0"}Tax-free purchase!{/if}` **4. By Discount Codes** - Specific discount code applied: `{if discount_codes="SUMMER20"}Special summer discount applied!{/if}` - No discount applied: `{if discount_codes=""}No discount applied.{/if}` **5. By User Role** - For subscribers: `{if user_role="subscriber"}Hello, valued subscriber!{/if}` - For customers with the 'administrator' role: `{if user_role="administrator"}Special message for admins.{/if}` **6. Multiple Conditions** - PayPal and order is $100 or more: `{if gateway="paypal" price=">=100"}PayPal and order is $100 or more!{/if}` - Stripe and user is a subscriber: `{if gateway="stripe" user_role="subscriber"}Stripe payment from a subscriber!{/if}` - High-value order with tax: `{if price=">100" tax=">10"}High-value order with significant tax.{/if}` == Conditional Content Blocks == You can show or hide content in your emails based on order or user properties using {if ...} blocks. === Basic usage === {if gateway="stripe"} Thank you for paying with Stripe! {/if} === Multiple conditions (AND/OR) === {if gateway="stripe" OR gateway="paypal"} Thank you for using an online payment method! {/if} {if user_role="administrator" AND gateway="stripe"} Special admin Stripe message! {/if} - Use AND to require all conditions to be true. - Use OR to require at least one condition to be true. - You can mix and match as needed: {if gateway="stripe" OR gateway="paypal" AND user_role="customer"} === Supported Operators === - AND, OR (logical operators): {if gateway="stripe" OR gateway="paypal"} == Frequently Asked Questions == = Can I add my own conditions? = Yes! Developers can extend the `$conditions` array in the plugin code to add more custom logic. = Does this work with all EDD email templates? = Yes, it works with any template that uses EDD's email tag system. = Is this plugin translation-ready? = Absolutely! The plugin is fulgit ly ready for localization. == Screenshots == 1. Example usage in an EDD email template. 2. Conditional content in a customer email. == Changelog == = 1.0.3 = * **BUGFIX** : Fixed missing package files = 1.0.2 = * **BUGFIX** : Fixed missing package files = 1.0.1 = * **BREAKING CHANGE:** Renamed `amount` condition to `price` to match EDD core email tag naming convention * **FEATURE:** Implemented auto-discovery system for core conditions * **FEATURE:** Added extensibility hook `eddcet_register_conditions` for custom condition registration * **FEATURE:** Added `tax` condition for order tax amount comparisons * **FEATURE:** Added `discount_codes` condition for discount code targeting * **FEATURE:** Support for AND/OR logic in {if} blocks for conditional content. * **IMPROVEMENT:** Gateway condition now supports both = and != operators for more flexible email rules. * **IMPROVEMENT:** Enhanced error handling in condition registration with proper null checks * **IMPROVEMENT:** Updated all documentation to reflect new naming conventions * **IMPROVEMENT:** Added comprehensive developer documentation and examples * **BUGFIX:** Fixed reflection error when checking constructor parameters = 1.0.0 = * Initial release 🎉 == Upgrade Notice == = 1.0.1 = **BREAKING CHANGE:** Update your email templates to use `{if price="50"}` instead of `{if amount="50"}`. = 1.0.0 = First release. No upgrade steps needed. == Credits == Developed by [Mihai Joldis](https://github.com/mihaijoldis) == License == This plugin is licensed under the GPLv2 or later.