I'm very new to M2.

I have a block that is being added to front-end if there is no Mail In Rebate or Special Price applied to the product.

Class looks something like this:


declare(strict_types = 1);

namespace Company\Catalog\Block\Product\View;

use Magento\Catalog\Block\Product\View\Description;

class ListedPrice extends Description
     * @return bool
    public function isListedPrice(): bool
        $product = $this->getProduct();

        if ($product->getSpecialPrice() || $product->getMnlMailInRebate()) {
            return false;

        return true;

How can I add a check a product for Catalog Price rules?

We have a Group of customers that gets discounts based on Catalog Price rules and this block is being shown to them which destroys the layout.

Thanks in advance!


Alright, I think you wanna give a try based on this example . Look at block method where using factory, you create a product instance and load details about that product. you could define something similar in your logic for this check.

getMnlMailInRebate this seems a custom method so I assume you already have something built to retrieve this data from db.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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