magepsycho / magento2-discountlabel

magepsycho/magento2-discountlabel

Magento 2 Product Discount Label

magento2-module Compatibility: 2.4.7 Code Quality: Fail Tests: N/A Security: Pass OSL-3.0

Magento 2 Product Discount Label

Magento 2 Product Discount Label

Packagist Version
Packagist Downloads
Supported Magento Versions
License

Overview

Magento 2 Product Discount Label allows displaying custom discount labels with calculated savings on catalog and cart pages.

Showing custom labels with calculated discount (ex: SAVE X%, -X%, .etc.) draws the attention of the users and motivates purchasing behavior.
In other words, this extension helps to promote products and get higher conversion rates.

This is an absolute "must-have" for every store - especially stores which offer deals and discounts.

Key Features

  • Enable/disable the extension as per store
  • Option to set the custom label with a dynamic discount placeholder on the catalog/product page
  • Option to set the custom label with a dynamic discount placeholder on the cart page

Feature Highlights

Set Discount Label

With this extension, the store admin can set different discount labels for both catalog & cart pages.

Some examples:

  • SAVE {{discount_percent}}%
  • -{{discount_percent}}%
  • etc.

{{discount_percent}} will be replaced by discount percent value.

M2 Product Discount Label - Admin Settings

M2 Product Discount Label - Product Page

Installation

  1. Download the extension .zip file and extract the files.
  2. Copy the extension files from src/ folder to the {your-magento2-root-dir}/app/code/MagePsycho/DiscountLabel (create non-existing folders manually)
  3. Run the following series of commands from the SSH console of your server:
php bin/magento module:enable MagePsycho_DiscountLabel --clear-static-content
php bin/magento setup:upgrade
  1. Flush the store cache
php bin/magento cache:flush
  1. Deploy static content - in Production mode only
rm -rf pub/static/* var/view_preprocessed/*
php bin/magento setup:static-content:deploy
  1. Go to Admin > CATALOG > Discount Label > Manage Settings

Live Demo:

Changelog

Version 1.0.0 (2022-02-02)

  • Initial Release.

Authors

  • Raj KB Twitter Follow

Contributors

Contributors

To Contribute

Any contribution to the development of Magento 2 Product Discount Label is highly welcome.
The best possibility to provide any code is to open a pull request on GitHub.

Need Support?

If you encounter any problems or bugs, please create an issue on GitHub.

Please visit our store for more FREE / paid extensions OR contact us for customization / development services.

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
1.0.0 stable Fail Magento 2.4.7 Details 2022-02-23 11:43:38

No dependencies declared

This package's composer.json doesn't declare any required, suggested, replaced, or conflicting packages.

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Fail di error
2.4.9 Fail di error Fail di error

Code Quality - Static Tests

Checks run directly against the module's source code, independent of any Magento or PHP version: coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity, and a security audit of its declared dependencies. Each runs once.

Static code-quality results
Tool Status Findings Summary
PHPCS Warning 41 41 warnings (ruleset: Magento2) — 31 auto-fixable with phpcbf
PHPMD Warning 2 2 rule violations (UnusedFormalParameter:1, IfStatementAssignment:1)
Cpd Pass 0
Composer validate Info 1 valid; 1 advisory note (composer validate --strict)
Composer audit Pass 0

Code Quality - PHPStan

PHPStan type-checks the module's PHP against a real Magento install (so framework and core-module symbols resolve) at the configured gate level. Because the available symbols differ between releases, it runs separately for each Magento and PHP version. The grid below shows the result for each pairing; select one to see its findings. This never affects compatibility.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 1 2
2.4.9 2 2

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

More from magepsycho

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.