Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

getproductpricehtml magento 2

   public function getProductPriceHtml(MagentoCatalogModelProduct $product)
    {
        $priceRender = $this->getLayout()->getBlock('product.price.render.default');
        if (!$priceRender) {
            $priceRender = $this->getLayout()->createBlock(
                MagentoFrameworkPricingRender::class,
                'product.price.render.default',
                ['data' => ['price_render_handle' => 'catalog_product_prices']]
            );
        }

        $price = '';
        if ($priceRender) {
            $price = $priceRender->render(
                MagentoCatalogPricingPriceFinalPrice::PRICE_CODE,
                $product,
                [
                    'display_minimal_price'  => true,
                    'use_link_for_as_low_as' => true,
                    'zone' => MagentoFrameworkPricingRender::ZONE_ITEM_LIST
                ]
            );
        }
        return $price;
    }
 
PREVIOUS NEXT
Tagged: #getproductpricehtml #magento
ADD COMMENT
Topic
Name
2+1 =