TransWikia.com

Magento 2 How to check Price Type?

Magento Asked by Jackson on October 21, 2020

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

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!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP