Skip to content

WooCommerce plugin to better manage and display product sale labels.

License

Notifications You must be signed in to change notification settings

netzstrategen/woocommerce-sale-percentage

Repository files navigation

GitHub

Sale Percentage

This plugin improves the way WooCommerce manages and displays product sale labels as follows:

  • Shows the calculated discount percentage taking in account the product regular and sale prices.
  • Displays the lowest/highest discount percentage for all the variations of a product.
  • Ensures the sale label is displayed only if the sale percentage reaches a minimum value, defined as a WooCommerce custom configuration setting (10% by default).
  • Ensures performance by recalculating and saving the products sale percentage only when its regular price or sale price is modified.
  • Provides a wp-cli command to force the recalculation of the sale percentage for a single product, several or all products in the shop.
  • Is compatible with WooCommerce Advanced Bulk Edit plugin.

⚙️ How to Install

⚠️ The plugin requires WooCommerce to be installed.

  1. Open your WordPress installation root path in the terminal.
  2. git submodule add --name sale-percentage -- git@github.com:netzstrategen/woocommerce-sale-percentage.git wp-content/plugins/sale-percentage
  3. Activate the plugin: wp plugin activate sale-percentage

⚡ WP CLI

This plugin provides a wp-cli command to force the recalculation of the sale percentage for a single product, several or all products in the shop.

Usage: wp sale-percentage refresh [<product-ids-list> | --all]

Examples:

  • wp sale-percentage refresh 2165, 2166, 2167
  • wp sale-percentage refresh --all

🏗️ How to Contribute

Any kind of contribution is very welcome!

Please, be sure to read our Code of Conduct before start contributing.

If you notice something wrong please open an issue or create a Pull Request or just send an email to tech@netztsrategen.com. If you want to warn me about an important security vulnerability, please use the GitHub Security page.

🛠️ Dev Setup

Requirements:

Setup steps:

  1. git clone git@github.com:netzstrategen/woocommerce-sale-percentage.git
  2. cd woocommerce-sale-percentage
  3. npm install
  4. npm run build

Available Scripts

  • npm run serve ·Builds all assets and watches for changes. Alias for gulp watch.
  • npm run build · Builds all the assets. Alias for gulp build.

📄 License

GPL-2.0 License © netzstrategen