0

Am adding special price with Original Price Strike-through

  • Do you want to show this on which page? – Dhiren Vasoya Oct 2 at 7:27
  • In prodcut page – user81874 Oct 2 at 7:29
0

to get product special price, you can use this code.

protected $_productRepository;

public function __construct( 
    \Magento\Catalog\Model\ProductRepository $productRepository,
) {
    $this->_productRepository = $productRepository;
}

public function getSpecialPriceById($id)
{
    $product = $this->_productRepository->getById($id);
    return $product->getSpecialPrice();
}

}

Now from phtml you need to call function like this one.

$id = 32;
echo $block->getSpecialPriceById($id);
  • any free plugin is there to do this? – user81874 Oct 2 at 7:36
  • You can search, if you found that one. If above answer help you please accept and upvote, so it can be help other in community. – Dhiren Vasoya Oct 2 at 7:37

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.