Skip to content

Commit 4cde0ce

Browse files
SarmisthaSarmistha
authored andcommitted
Merge remote-tracking branch 'magento-l3/ACP2E-2303' into 2.4-develop
2 parents 04add01 + cc4e0b1 commit 4cde0ce

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

app/code/Magento/Tax/Model/Config.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,9 @@ public function needPriceConversion($store = null)
921921
$res = false;
922922
$priceIncludesTax = $this->priceIncludesTax($store)
923923
|| $this->getNeedUseShippingExcludeTax()
924-
|| $this->shippingPriceIncludesTax($store);
924+
|| $this->shippingPriceIncludesTax($store)
925+
|| $this->displayCartShippingInclTax()
926+
|| $this->displayCartShippingBoth();
925927
if ($priceIncludesTax) {
926928
switch ($this->getPriceDisplayType($store)) {
927929
case self::DISPLAY_TYPE_EXCLUDING_TAX:

app/code/Magento/Tax/Test/Unit/Model/ConfigTest.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,4 +381,50 @@ public function dataProviderScopeConfigMethods(): array
381381
]
382382
];
383383
}
384+
385+
/**
386+
* Tests check if necessary do product price conversion
387+
*
388+
* @return void
389+
*/
390+
public function testNeedPriceConversion(): void
391+
{
392+
$scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class);
393+
$scopeConfigMock
394+
->method('getValue')
395+
->willReturnMap(
396+
[
397+
[
398+
Config::XML_PATH_DISPLAY_CART_SHIPPING,
399+
ScopeInterface::SCOPE_STORE,
400+
null,
401+
true
402+
],
403+
[
404+
Config::XML_PATH_DISPLAY_CART_SHIPPING,
405+
ScopeInterface::SCOPE_STORE,
406+
null,
407+
false
408+
],
409+
[
410+
Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE,
411+
ScopeInterface::SCOPE_STORE,
412+
null,
413+
true
414+
],
415+
[
416+
Config::XML_PATH_DISPLAY_CART_PRICE,
417+
ScopeInterface::SCOPE_STORE,
418+
null,
419+
false
420+
]
421+
]
422+
);
423+
/** @var Config */
424+
$model = new Config($scopeConfigMock);
425+
$model->setPriceIncludesTax(false);
426+
$model->setNeedUseShippingExcludeTax(false);
427+
$model->setShippingPriceIncludeTax(false);
428+
$this->assertEquals(true, $model->needPriceConversion());
429+
}
384430
}

0 commit comments

Comments
 (0)