=== Beep Conditional Payments === Contributors: beepcoder, sarwarz Author URI: https://beepcoder.com/ Donate link: https://beepcoder.com Plugin URI: https://wordpress.org/plugins/beep-conditional-payments Tags: woocommerce, payments, conditional payments, checkout, payment gateways Requires at least: 5.8 Tested up to: 6.9 Requires PHP: 8.0 Stable tag: 1.0.3 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Control WooCommerce payment methods with flexible rules. Enable, disable, or add fees based on order, products, or customers. == Description == **Beep Conditional Payments** lets you show or hide WooCommerce payment gateways at checkout depending on conditions you define. You can also add extra fees for specific scenarios (Pro version). Easily build rules like: * Enable *Bank Transfer* only for orders above $100. * Disable *Cash on Delivery* for digital products. * Add a $5 fee when a coupon is applied (Pro). * Show different payment methods depending on user roles or location. ### Why use Beep Conditional Payments? - Save time managing payment options. - Prevent unwanted gateways from appearing. - Apply smart business logic without code. - Create unlimited rulesets. --- ### Legend (condition availability) * **[FREE]** — Shipped in this plugin today: appears in the rule builder and is evaluated at checkout. * **[PRO]** — Reserved for **Beep Conditional Payments Pro** (or a future release): not evaluated in the free build; listed here as the product roadmap. --- ### Master condition list (catalog vs. edition) Below is the full condition taxonomy for the Beep Conditional Payments product line. Items marked **[FREE]** match the slugs registered in `beep_get_conditions()` and handled in checkout evaluation for this release. #### 1. Product-based conditions * Specific product(s) in cart **[FREE]** — `products` (IDs / variations; standard operators). * Variable products in cart **[FREE]** — `variable_products`. * Product category **[FREE]** — `product_categories`. * Product tag **[FREE]** — `product_tags`. * Product type (simple, variable, subscription, etc.) **[PRO]** — dedicated rule (UI hooks exist for extensions; not a default free slug). * Product SKU as its own rule **[PRO]** — SKU is searched when picking products; standalone “match by SKU only” is Pro roadmap. * Product attribute (color, size, etc.) **[PRO]**. * Product stock status (in stock / out of stock / on backorder) **[PRO]** — `stock_status` UI path is reserved for Pro. * Product on sale **[PRO]**. * Featured product **[PRO]**. * Virtual / downloadable product **[PRO]**. * Product shipping class **[PRO]** — taxonomy-backed selector reserved for Pro. * Product brand **[PRO]** — when a `product_brand` (or compatible) taxonomy is present; Pro-tier packaging. * Product meta (custom fields) **[PRO]**. #### 2. Cart conditions * Cart contains / does not contain specific product **[FREE]** — via `products` operators (`in`, `not_in`, legacy include/exclude, etc.). * Cart contains category / tag **[FREE]** — `product_categories`, `product_tags`. * Cart subtotal **[FREE]** — `order_subtotal`. * Cart total (incl. tax as configured by Woo) **[FREE]** — `cart_total`. * Cart total min / max band **[FREE]** — `cart_total_minmax`. * Cart tax total **[PRO]**. * Cart discount total **[PRO]** — beyond coupon-amount conditions (see coupons). * Cart weight **[PRO]**. * Cart volume (dimensions) **[PRO]**. * Number of line items in cart **[FREE]** — `number_items`. * Number of unique products **[PRO]**. * Cart contains only virtual / only physical / mixed **[PRO]**. #### 3. Quantity conditions * Quantity of a specific product **[PRO]** — granular per-SKU line qty (free uses list membership on cart IDs). * Quantity in category **[PRO]**. * Total quantity in cart **[PRO]** — distinct from `number_items` (line count). * Min / max quantity thresholds **[PRO]**. #### 4. Price / amount conditions * Cart total > / < / = / between **[FREE]** — `cart_total`, `cart_total_minmax`. * Subtotal > / < / = **[FREE]** — `order_subtotal`. * Product price at line level **[PRO]**. * Average order value (historical) **[PRO]**. * Multi-currency amount rules **[PRO]**. #### 5. Customer conditions * Logged in vs guest **[FREE]** — `logged_in`. * User role **[FREE]** — `role`. * Specific user ID **[PRO]**. * User email **[PRO]** — beyond billing email field matching. * User registration date **[PRO]**. * Customer order count / total spent **[PRO]**. * First order vs returning customer **[PRO]**. * Customer meta **[PRO]**. #### 6. Location conditions * Billing country **[FREE]** — `billing_country`. * Shipping country **[FREE]** — `shipping_country`. * Billing state **[FREE]** — `billing_state`. * Shipping state **[FREE]** — `shipping_state`. * Billing / shipping first name, last name, company, email, phone, postcode **[FREE]** — matching text fields. * City (dedicated) **[PRO]** — not split from generic address meta in free. * ZIP / postcode pattern beyond shipping postcode field **[PRO]**. * IP-based / GeoIP location **[PRO]**. #### 7. Shipping conditions * Shipping method (chosen rate IDs / labels) **[FREE]** — `shipping_method`. * Shipping class in cart **[PRO]**. * Shipping zone **[PRO]**. * Shipping cost **[PRO]**. * Local pickup selected **[PRO]**. #### 8. Payment context (advanced) * Previously used payment method **[PRO]**. * Payment retry / failed payment counts **[PRO]**. #### 9. Order history * Total orders / completed / pending **[PRO]**. * Last order date / frequency **[PRO]**. * Lifetime value (LTV) **[PRO]**. #### 10. Time & date * Date range (start to end) **[PRO]** — `daterange` field exists in the admin renderer for extensions; not evaluated in the free switch today. * Specific date / day of week / time of day **[PRO]**. * Holidays / special events **[PRO]**. #### 11. Coupon conditions * Coupon applied (yes / no) **[FREE]** — `coupon_applied`. * Specific coupon code(s) **[FREE]** — `coupon_code`. * Coupon discount amount **[FREE]** — `coupon_amount` (compares to cart discount total). * Coupon discount type **[FREE]** — `coupon_type`. #### 12. Device / session (advanced) * Device type (mobile / desktop / tablet) **[PRO]**. * Browser / referral / landing URL **[PRO]**. * Session or cart age **[PRO]**. #### 13. Custom meta * Product / cart / order / user meta rules **[PRO]**. #### 14. WooCommerce Subscriptions * Subscription in cart / status / renewal / trial **[PRO]** — requires Subscriptions-aware logic. #### 15. Multi-currency & language * Store currency switch rules **[PRO]**. * Language (WPML / Polylang) **[PRO]**. #### 16. Custom logic (developer tier) * PHP callback condition **[PRO]**. * Custom filter hook **[PRO]** — `beep_conditions` / related filters already allow developers to extend free; first-party UI for “custom callback” is Pro roadmap. * Remote API-based condition **[PRO]**. --- ### Free edition (this repository) * Unlimited conditional **rulesets** * **Enable or disable** WooCommerce payment gateways at checkout * Export and import rulesets (**JSON**), duplicate, delete * **Conditions included in this build** (see **[FREE]** markers in the master list above), including for example: cart total and min/max band, order subtotal, number of line items, shipping method, products and variations in cart, product categories and tags, coupon applied/code/amount/type, billing and shipping address fields, logged-in vs guest, user role --- ### Pro edition (commercial upgrade) * Everything in the **Free edition** * **Payment method fees** at checkout (charge an amount when specific gateways are selected) * **Advanced conditions** from the master list marked **[PRO]** (stock, dates, order history, GeoIP, subscriptions, multi-currency, device/session, meta, custom callbacks, and more — see beepcoder.com for the current Pro matrix) * Priority support and ongoing updates --- == Screenshots == 1. Plugin Settings - Manage Payment Condition 2. Plugin Settings - Add New Condition 3. Plugin Settings - All Predifine Condition 4. Plugin Settings - All Predifine Action == Installation == 1. Upload the plugin files to `/wp-content/plugins/beep-conditional-payments/`, or install via WordPress **Plugins → Add New**. 2. Activate the plugin. 3. Go to **WooCommerce → Settings → Payments**, then open the **Conditions** section. 4. Click **Add Ruleset** to create your first rule. == Frequently Asked Questions == = Where do I find the settings? = Go to **WooCommerce → Settings → Payments** and choose **Conditions** (next to General). = Can I export/import my rules? = Yes. Use the **Tools** section to download or import JSON rules. = Will this work with third-party gateways? = Yes, it works with all WooCommerce payment gateways. = How do I upgrade to Pro? = Pro adds payment method fees and the advanced conditions marked **[PRO]** in the readme master list (stock, dates, order history, GeoIP, subscriptions, and more). Visit [beepcoder.com](https://beepcoder.com) for the current matrix. == Screenshots == 1. Rulesets overview page with enable/disable toggle. 2. Rule editor – add conditions and actions. 3. Tools section – export/import rulesets. 4. Example checkout with hidden payment methods. == Changelog == = 1.0.3 = * Pro upgrade modal: right column now shows plugin branding (bundled icon; you can replace it with `admin/images/icon-256x256.png` or filter `beep_cp_pro_upgrade_modal_icon_url`). * Readme and metadata aligned for WordPress.org (tested up to, Requires PHP, plugin name). = 1.0.2 = * Moved settings to **WooCommerce → Settings → Payments → Conditions** (with redirect from the old standalone tab URL). = 1.0.1 = * Code improvements: added sanitization/escaping for all inputs/outputs. * Updated AJAX handlers with nonce and input validation. * Ensured WordPress.org coding standards compliance. * Improved security and stability. = 1.0.0 = * Initial release. * Add rulesets with conditions and actions. * Enable/disable WooCommerce payment methods. * Export & Import rulesets. * Duplicate and delete rules. == Upgrade Notice == = 1.0.3 = Pro upgrade dialog uses a branding image instead of the old discount tile; optional custom logo via `admin/images/icon-256x256.png`. = 1.0.2 = Settings now live under Payments → Conditions. Old bookmarks to the previous tab redirect automatically. = 1.0.1 = Security and code quality improvements. Please update to ensure compliance with WordPress coding standards. = 1.0.0 = First release of Conditional Payments for WooCommerce. Create flexible rules to control checkout payment methods.