Repository navigation
Releases: ROLLPIX/M2-Discount-labels
Releases · ROLLPIX/M2-Discount-labels
Release list
v1.2.1 - Bugfix + Page Builder Support
Fixes
- Critical fix: Resolved
TypeError: Cannot read properties of undefined (reading 'indexOf')inbadge-renderer.js— caused bystyles.positionbeingundefinedwhen config values from previous versions weren't migrated to the new paths - PHP Config: Position now falls back to
after_old_price_inlineif the stored value is empty/null - JS Renderer: Defensive checks for
undefinedstyles, position, and badgeStyle throughout the rendering pipeline - FPC Compatibility:
setConfig()now ensurespdpStylesandlistingStylesexist even when Full Page Cache serves HTML from older module versions
New
- Page Builder Support: Added
MutationObserverin the initializer to detectpriceBoxelements added dynamically to the DOM — covers Page Builder product widgets (grid, carousel), AJAX-loaded content, and lazy-loaded blocks
Update
composer require rollpix/module-discount-badge:1.2.1
bin/magento setup:upgrade
bin/magento cache:flushFor static content in production mode:
bin/magento setup:static-content:deploy -fv1.2.0
Changes
- 4 position options near old price: inline (same line) and block (new line) for both before/after
- Backward compatibility: Legacy values from v1.0.0 (
after_old_price) and v1.1.0 (right_of_old_price) are automatically mapped — no manual config reset needed on upgrade - Block position CSS: New
.rollpix-discount-badge--blockclass for new-line display
Position options
| Value | Description |
|---|---|
| After old price — same line | Inline-flex, badge right of strikethrough price |
| After old price — new line | Badge on its own line below strikethrough price |
| Before old price — same line | Inline-flex, badge left of strikethrough price |
| Before old price — new line | Badge on its own line above strikethrough price |
| Over image (4 corners) | Absolute positioned over product image |
| Below price block | Below the entire price block |
Upgrade
composer require rollpix/module-discount-badge:1.2.0
bin/magento cache:flushNo need to re-select position in admin — old values are auto-mapped.
v1.1.0
Changes
- Independent badge position: PDP and Listing now have separate position settings
- Inline flex fix: Badge renders on the same line as the old price (inline-flex wrapper)
- Renamed positions:
right_of_old_price/left_of_old_pricefor clarity - Composer install: README now includes
composer config repositoriesstep
Upgrade note
If upgrading from v1.0.0, re-select the badge position in admin for both PDP and Listing groups (the old after_old_price value is no longer valid).
v1.0.0 - Rollpix Discount Badge
Rollpix_DiscountBadge v1.0.0
Dynamic discount percentage badge for Magento 2 product prices.
Features
- Calculates discount % from
regular_pricevsfinal_price - Displays badge in all price contexts: category, PDP, search, widgets
- Updates dynamically on configurable product option changes
- 5 visual styles: Filled, Outline, Pill, Pill Outline, Text Only
- 7 position options: inline with price, over product image, below price
- Independent styling for PDP and listing contexts
- Custom CSS field for per-store overrides
- Configurable minimum discount threshold
- Translatable text template per Store View
- FPC & Varnish compatible — 100% client-side JS
Compatibility
- Magento 2.4.7 ~ 2.4.8
- PHP 8.1 ~ 8.3
Installation
composer require rollpix/module-discount-badge
bin/magento module:enable Rollpix_DiscountBadge
bin/magento setup:upgrade
bin/magento cache:flushConfiguration
Stores > Configuration > Rollpix > Discount Badge