Skip to content

Commit f670d7a

Browse files
authored
ENGCOM-3559: make sure that the removal of the custom_price is properly persisted into database #19402
2 parents 93c9158 + af6491d commit f670d7a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

app/code/Magento/Quote/Model/Quote/Item/Updater.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function __construct(
6060

6161
/**
6262
* Update quote item qty.
63+
*
6364
* Custom price is updated in case 'custom_price' value exists
6465
*
6566
* @param Item $item
@@ -145,8 +146,8 @@ protected function unsetCustomPrice(Item $item)
145146
$item->addOption($infoBuyRequest);
146147
}
147148

148-
$item->unsetData('custom_price');
149-
$item->unsetData('original_custom_price');
149+
$item->setData('custom_price', null);
150+
$item->setData('original_custom_price', null);
150151
}
151152

152153
/**

app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function setUp()
6767
'addOption',
6868
'setCustomPrice',
6969
'setOriginalCustomPrice',
70-
'unsetData',
70+
'setData',
7171
'hasData',
7272
'setIsQtyDecimal'
7373
]);
@@ -353,7 +353,11 @@ public function testUpdateUnsetCustomPrice()
353353
->will($this->returnValue($buyRequestMock));
354354

355355
$this->itemMock->expects($this->exactly(2))
356-
->method('unsetData');
356+
->method('setData')
357+
->withConsecutive(
358+
['custom_price', null],
359+
['original_custom_price', null]
360+
);
357361

358362
$this->itemMock->expects($this->once())
359363
->method('hasData')

0 commit comments

Comments
 (0)