Skip to content

Commit c720d97

Browse files
author
Vasilii Burlacu
committed
magento/magento2:#18979 - API: Bundle Product Option Repository Delete method removes incorrect option
1 parent da1a96c commit c720d97

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

app/code/Magento/Bundle/Model/OptionRepository.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ public function delete(\Magento\Bundle\Api\Data\OptionInterface $option)
160160
*/
161161
public function deleteById($sku, $optionId)
162162
{
163-
$product = $this->getProduct($sku);
164-
$optionCollection = $this->type->getOptionsCollection($product);
165-
$optionCollection->setIdFilter($optionId);
166-
$hasBeenDeleted = $this->delete($optionCollection->getFirstItem());
163+
/** @var \Magento\Bundle\Api\Data\OptionInterface $option */
164+
$option = $this->get($sku, $optionId);
165+
$hasBeenDeleted = $this->delete($option);
167166

168167
return $hasBeenDeleted;
169168
}

0 commit comments

Comments
 (0)