I started in Magento 2 a week ago and don't know much about it, I created a Cart Price Rule named "10% billet discount" that is applied in a few items, with specific attributes.

I want to display this Rule on specific products page that the rule is applied. There is a way that I can do that?

  • Welcome, to Magento StackExchange. I think you need to create a catalog price rule for that. Apr 20, 2018 at 11:31
  • i thought that too, but i can't set one condition for payment method (billet) in catalog price rule. Apr 20, 2018 at 11:45
  • Has anybody any ideas how to achieve that? Jul 27, 2018 at 13:56

1 Answer 1


Wreite on code product listing page or product details page.

                                  $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
                                  $rules = $objectManager->create('Magento\SalesRule\Model\RuleFactory')->create();
                                  $objDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\DateTime');
                                  $_currentTime = strtotime($objDate->date());
                                  foreach ($rules as $rule) {
                                        $fromDate = $rule->getFromDate();
                                        $toDate = $rule->getToDate();
                                        if (isset($fromDate) && $_currentTime >= strtotime($fromDate)) {
                                            if (isset($toDate)) {
                                                if (strtotime($toDate) >= $_currentTime) {

                                                $product = $objectManager->get('Magento\Catalog\Model\Product')->load($_product->getId());
                                                $item = $objectManager->create('Magento\Catalog\Model\Product');
                                                if ($rule->getActions()->validate($item)) {


                            echo '<div class="product-labels">'.$product_label.'</div>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.