我已经使用此在magento 2.1中应用了自定义折扣。一切都在本地系统上运行,但是当我将更改部署到服务器上时,折扣会从总数中减去两次。有人对此有任何想法吗?
Sales.xml
<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Sales:etc/sales.xsd">
<section name="quote">
<group name="totals">
<item name="test_discount" instance="Namespace\Modulename\Model\Quote\Discount" sort_order="500"/>
</group>
</section>
Run Code Online (Sandbox Code Playgroud)
小智 7
要在摘要中删除两次应用的自定义折扣,只需在以下行中添加
$items = $shippingAssignment->getItems();
if (!count($items)) {
return $this;
}
Run Code Online (Sandbox Code Playgroud)
在collect方法中。完成后,将如下所示。
public function collect(
\Magento\Quote\Model\Quote $quote,
\Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment,
\Magento\Quote\Model\Quote\Address\Total $total
) {
$items = $shippingAssignment->getItems();
if (!count($items)) {
return $this;
}
parent::collect($quote, $shippingAssignment, $total);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1648 次 |
| 最近记录: |