Skip to content

Commit 166f638

Browse files
committed
BUG#AC-8227: Tax Class set to None when creating new configurable variations in multi store mode
1 parent b388e2a commit 166f638

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/VariationHandler.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
namespace Magento\ConfigurableProduct\Model\Product;
99

10-
use Magento\Catalog\Model\Product\Attribute\Source\Status;
1110
use Magento\Catalog\Model\Product\Type as ProductType;
1211
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1313

1414
/**
1515
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1616
* @api
1717
* @since 100.0.2
1818
*/
19-
class VariationHandler
19+
class VariationHandler implements ResetAfterRequestInterface
2020
{
2121
/**
2222
* @var \Magento\Catalog\Model\Product\Gallery\Processor
@@ -52,7 +52,7 @@ class VariationHandler
5252
/**
5353
* @var \Magento\CatalogInventory\Api\StockConfigurationInterface
5454
* @deprecated 100.1.0
55-
* @see MAGETWO-71174
55+
* @see MSI
5656
*/
5757
protected $stockConfiguration;
5858

@@ -121,7 +121,7 @@ public function generateSimpleProducts($parentProduct, $productsData)
121121
* Prepare attribute set comprising all selected configurable attributes
122122
*
123123
* @deprecated 100.1.0
124-
* @see MAGETWO-71174
124+
* @see prepareAttributeSet()
125125
* @param \Magento\Catalog\Model\Product $product
126126
* @return void
127127
*/
@@ -205,6 +205,7 @@ protected function fillSimpleProductData(
205205
$parentProduct->getData($attribute->getAttributeCode()) ?? $attribute->getDefaultValue()
206206
);
207207
}
208+
208209
$keysFilter = ['item_id', 'product_id', 'stock_id', 'type_id', 'website_id'];
209210
$postData['stock_data'] = array_diff_key((array)$parentProduct->getStockData(), array_flip($keysFilter));
210211
$stockStatus = $parentProduct->getQuantityAndStockStatus();
@@ -213,7 +214,9 @@ protected function fillSimpleProductData(
213214
}
214215

215216
$postData = $this->processMediaGallery($product, $postData);
216-
$postData['status'] = $postData['status'] ?? Status::STATUS_ENABLED;
217+
$postData['status'] = isset($postData['status'])
218+
? $postData['status']
219+
: \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED;
217220
$product->addData(
218221
$postData
219222
)->setWebsiteIds(
@@ -300,4 +303,12 @@ function ($image) {
300303
}
301304
return $productData;
302305
}
306+
307+
/**
308+
* @inheritDoc
309+
*/
310+
public function _resetState(): void
311+
{
312+
$this->attributes = [];
313+
}
303314
}

0 commit comments

Comments
 (0)