Magento 2 How to check Price Type?

File location

<magento dir>vendormagentomodule-directoryModelCurrency.php

In Magento we have “finalPrice” & “oldPrice”

Can anybody tell me how to check Price Type? Can we use

$priceCurrencyObject = $_objectManager->get('MagentoFrameworkPricingPriceCurrencyInterface');

Not sure

Magento Asked by Jackson on October 21, 2020

1 Answers

One Answer

My Solution is: In the Magento_Catalogtemplatesproductpriceamountdefault.phtml , use $block->getPrice()->getPriceCode() to get the price type string.

Or any function you can find which return object implements the MagentoFrameworkPricingPricePriceInterface, you can call the getPriceCode() to get the price type.

Or if you have the product object, just call $product->getPriceInfo()->getPrice()->getPriceCode();

Hoping it's helpful to you.

Answered by Yue Wang on October 21, 2020

Add your own answers!

Related Questions

is creating block within template in magento 2 good practice

0  Asked on July 24, 2020 by herve-tribouilloy


Ask a Question

Get help from others!

© 2021 All rights reserved.