Round resulting sale price to a pleasant (rounded) amount #2412
Unanswered
lukeholder
asked this question in
Ideas
Replies: 1 comment
-
You could get around this for now with an event that modifies the sale price. The example below rounds down to nearest use craft\commerce\events\LineItemEvent;
use craft\commerce\services\LineItems;
use craft\commerce\models\LineItem;
use yii\base\Event;
Event::on(
LineItems::class,
LineItems::EVENT_POPULATE_LINE_ITEM,
function(LineItemEvent $event) {
// @var LineItem $lineItem
$lineItem = $event->lineItem;
// @var bool $isNew
$isNew = $event->isNew;
// Modify the resulting sale price of a line item
// round down to nearest `.50`
$lineItem->salePrice = floor($ $lineItem->salePrice * 2) / 2;
}
); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When a sale is applied, the price of the item could result in a price that is unstrategic[0]
Sales pricing rules could have options to make the price more pleasant.
i.e
original price: $10.50
sale (%8) price: $9.66
with pricing display options on:
sale (%8) price: $9.65 (rounded to nearest .5)
[0]https://www.nickkolenda.com/psychological-pricing-strategies/
Beta Was this translation helpful? Give feedback.
All reactions