WP Manifestindependent plugin directory
manifest / ecommerce / woo-smart-discounts

Woo Smart Discounts

Advanced WooCommerce discount rules engine

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/oiahamzayy/woo-smart-discounts/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Advanced WooCommerce discount rules engine. Build conditional pricing strategies without touching code — percentage, fixed, tiered/bulk, role-based, and BOGO rules with date and cart conditions.


Features

  • Percentage & Fixed Discounts — apply to individual products, categories, or entire catalog
  • Tiered/Bulk Pricing — quantity breaks with configurable discount tiers
  • Role-Based Pricing — different prices per customer role (wholesale, VIP, etc.)
  • BOGO Rules — Buy X Get Y free or discounted
  • Condition Chaining — date range, minimum cart total, and role conditions
  • HPOS Compatible — fully supports WooCommerce High-Performance Order Storage
  • Cache-Aware — rules cached in the WP object cache, auto-invalidated on save
  • PHPUnit Tested — unit test coverage for the discount engine

Installation

composer install

Then activate in WordPress admin > Plugins.


Project Structure

woo-smart-discounts/
├── src/
│   ├── Plugin.php                  # Bootstrap singleton
│   ├── Discount/
│   │   ├── Engine.php              # Price filters & cart hooks
│   │   └── RuleManager.php         # Rule CPT, CRUD, caching
│   └── Admin/
│       └── SettingsPage.php        # WooCommerce submenu page
├── templates/
│   └── admin/settings-page.php
├── tests/
│   ├── bootstrap.php
│   └── Unit/
│       └── EngineTest.php
├── composer.json
├── phpunit.xml
└── woo-smart-discounts.php         # Plugin entry point

Architecture Decisions

Decision Rationale
Custom Post Type for rules Leverages WP revision history, REST API, and role capabilities without a custom table
Object cache for rules Prevents repeated DB queries on every product price calculation
match expression for discount types Exhaustive, readable, and throws UnhandledMatchError on unknown types — fast-fail over silent bugs
HPOS declaration Required for WooCommerce 8.x compatibility; future-proofs the plugin

Running Tests

composer install
composer test

Code Quality

composer lint      # PHP_CodeSniffer with WordPress standard
composer analyse   # PHPStan level 6

License

GPL-2.0+ — see LICENSE.