How to compress sales PDF size in Magento 2

Hello folks, welcome back to my new article about compress sales PDF file size. In default Magento, sales pdf size is approximately 3.2 MB. We can reduce the size to 3.5 KB only by changing the fonts of pdf. So you just need to override Magento pdf class for the invoice, shipment, and credit memo…

Continue Reading How to compress sales PDF size in Magento 2

Get order id by increment id Magento 2

In this article, I will show you how you can load order by increment id in Magento 2 We can use the order interface \Magento\Sales\Model\Spi\OrderResourceInterface to load order by increment id. Sample Code: use Magento\Sales\Api\Data\OrderInterface; class Mageprince { private $orderResource; private $orderFactory; public function __construct( \Magento\Sales\Model\Spi\OrderResourceInterface $orderResource, \Magento\Sales\Api\Data\OrderInterfaceFactory $orderFactory ){ $this->orderResource = $orderResource; $this->orderFactory =…

Continue Reading Get order id by increment id Magento 2

How to get a formatted price with currency in phtml file in Magento 2

In this article, I will show you how you can get the formatted price with currency. You can get the formatted price with class Magento\Directory\Model or Magento\Framework\Pricing\PriceCurrencyInterface or Magento\Framework\Pricing\Helper\Data 1. By using class Magento\Framework\Pricing\Helper\Data The best way of doing this by using class Magento\Framework\Pricing\Helper\Data as a dependency. This class has two methods currency and currencyByStore.…

Continue Reading How to get a formatted price with currency in phtml file in Magento 2