Customers decide in a second which product to click. Badges on the product images tell them at a glance what is new, what is on sale and what is sold out. This module adds these three badges automatically, from the data your products already have: no badges to assign by hand, nothing to forget when a sale starts or ends.
Features
- New: shown while today is within “Set Product as New from” and “to” of the product.
- Sale: shown when the product costs less than its regular price, whether through a special price, a catalog price rule or a tier price for one piece, and for the customer group of the visitor. Configurable products get the badge when one of their variants is on sale.
- Discount in percent: the Sale badge can show “-20%” instead of a text. If the variants of a product have different discounts, the text is shown instead.
- Sold Out: shown when the product cannot be bought.
- Badges appear in categories, search results, product list widgets and on the main image of the product page.
- Text, corner of the image, text color and background color per badge and store view. The texts can be translated like all other texts of your store.
- Badges change on time: cached pages are only kept until the next new-from or special price date, also with Varnish.
Configuration
Go to Stores > Configuration > Infrangible Solutions > Product Badges. Each badge has its own group with Enable, Text, Position, Text Color and Background Color; the Sale badge also has Show (text or discount in percent). All three badges are on by default.
Good to know
- Sold out products are only listed if “Display Out of Stock Products” is enabled under Catalog > Inventory > Stock Options.
- The module is made for Luma and themes based on it. A Hyvä version will follow.
Installation
Install the module with Composer in your Magento root directory:
composer require infrangible/m2-catalog-product-badgeThen enable it and update the store as described in the installation guide. Composer installs the required modules listed on this page automatically.