Magento 2:获取含税产品价格/特价?

时间:2019-12-09 09:50:31

标签: php magento magento2 magento-2.3

使用Magento 1,您可以执行以下操作以获取含税产品的价格:

$_product = $this->getProduct();
$_taxHelper  = $this->helper('tax');
$final_price = $_taxHelper->getPrice($_product, $_product->getFinalPrice(), true);

如何在Magento 2的.phtml文件中执行相同的操作?后端设置的价格是EX增值税,因此我需要该价格来获得相关的税率并将其乘以得到价格增值税。我读过某个地方,Magento会自动执行此操作,但是我似乎无法获得它来提取金额,我真的不想手动执行(将税额硬编码为变量,然后将变量乘以price变量)。

非常感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

使用敲除的Magento2。为此,您可以编辑html文件。

例如:

路径: app / design / frontend / Vendor / Theme_Name / Magento_Checkout / web / template / checkout / summary / item / details.html

<span class="price" data-bind="text: getFormattedPrice($parent.price_incl_tax)"></span>

或者,本主题可以为您提供帮助。

https://magento.stackexchange.com/questions/173028/magento-2-minicart-display-line-item-subtotal-rather-than-unit-price