WooCommerce Main Course Bulk Discount
Applies a bulk percentage discount only to explicitly marked main-course-price variations.
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/sasanzare/discount/archive/refs/heads/main.zipThis plugin is designed for variable WooCommerce products with three course-price variations:
- main course price;
- installment/first-installment price;
- freemium or free price with limited access.
The plugin changes only variations explicitly marked as Main course price (eligible) in the variation editor. Installment and freemium variations are protected, and a zero-priced freemium variation is never used as a discount base.
Installation
- Place this project directory in
wp-content/plugins/with the directory namewoo-main-course-bulk-discount. - Activate the plugin from the WordPress admin.
- Open
WooCommerce > Bulk course discounts. - In each variable product, assign a role to every relevant variation and save the product.
- Enter a percentage and run the bulk operation.
Existing sale-price behavior
When Apply the new discount to the previous sale price is enabled, the new discount is calculated from the sale price that existed before this plugin first changed the variation. For example, a regular price of 100, an existing sale price of 80, and a new discount of 10% produce a final sale price of 72.
When the option is disabled, the existing sale price is ignored and the new discount is calculated from the regular price. The same example produces a final sale price of 90.
The service stores the original sale price and sale dates before changing a variation. Re-running the operation does not compound the plugin's own generated sale price, and the restore action reverts only changes owned by this plugin.
Requirements
- WordPress 5.8 or later;
- PHP 7.4 or later;
- active WooCommerce.
Focused tests
The workspace does not include a WordPress/WooCommerce runtime. Run the standalone checks with:
php tests/test-discount-calculator.php
php tests/test-variation-role-filter.php
php tests/test-discount-service.php
For full integration validation, install the plugin on a staging WooCommerce site with a current backup before running the bulk action.