How to manipulate product price in magento 2?

438 Views Asked by At

I have been trying to markup the product price in magento 2.3 using catalog price rule. ie instead of discounting i need to increase the product price . As

In

\vendor\magento\module-catalog-rule\Model\Indexer\ProductPriceCalculator.php

, i have modified the cases

  1. by_fixed
  2. by_percent

in these instead of decreasing i was trying to add it to the product price

Please find the below code

 switch ($ruleData['action_operator']) {
            case 'to_fixed':
              //  $productPrice = min($ruleData['action_amount'], $productPrice);
                break;
            case 'to_percent':
            //    $productPrice = $productPrice * $ruleData['action_amount'] / 100;
                break;
            **case 'by_fixed':
                $productPrice = max(0, $productPrice + $ruleData['action_amount']);
                break;
            case 'by_percent':
                $productPrice = $productPrice * (1 + $ruleData['action_amount'] / 100);**
                break;
            default:
                $productPrice = 0;
        }

But when am trying to apply this , its not showing in the frontend ,

i have a product $100, and when i apply 50% off its should not reduce the price .Instead i need the product price as $150 . So i can markup the price using catalog rules.

Now its showing $100 only , i think its only showing the lowest price . Where i can find the validation and change this as per my needs

1

There are 1 best solutions below

0
Felipe Dominguesche On