1

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

Arun
  • 87
  • 13
  • Are you sure it's accessing the two cases that you modified to add the price? You've commented out the first two cases, maybe have them return a junk `$productPrice` just to make sure they're not being hit. – dazed-and-confused Aug 22 '19 at 13:19
  • @dazed-and-confused yes am sure , i have debugged those cases . any idea where the catalog price discount was calculating ? and how to modify that ? – Arun Aug 23 '19 at 01:51

1 Answers1

0

You can use this: https://devdocs.magento.com/guides/v2.4/extension-dev-guide/price-adjustments.html

Hope this helps. :)