diff --git a/CHANGELOG.md b/CHANGELOG.md index db220fc..96774cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Add optional `status` column for product imports and exports. - Refactor the Export Product sidebar button. +- Set `promotable` to true by default ## 2.0.5 - 2026-02-19 diff --git a/src/controllers/ProductVariantsController.php b/src/controllers/ProductVariantsController.php index 3ecd179..7136df1 100644 --- a/src/controllers/ProductVariantsController.php +++ b/src/controllers/ProductVariantsController.php @@ -46,6 +46,7 @@ public function actionProductExists(): Response if ($productId !== null) { $product = Product::find() ->id(Db::escapeParam($productId)) + ->status(null) ->one(); if ($product === null) { diff --git a/src/services/Csv.php b/src/services/Csv.php index 55dc48f..60fe92f 100644 --- a/src/services/Csv.php +++ b/src/services/Csv.php @@ -297,13 +297,18 @@ private function importSiteSpecificData(TabularDataReader $reader, $skuColumn, a $variant->availableForPurchase = true; } + if ($data->firstWhere('field', 'promotable') === null) { + // If the promotable field does not exist, then we will default it to true + $variant->promotable = true; + } + foreach ($data as $fieldData) { $field = $fieldData['field']; $properties = [ $field => $record[$fieldData['index']], ]; - if ($field === 'availableForPurchase') { + if ($field === 'availableForPurchase' || $field === 'promotable') { $value = $properties[$field]; if ($value === null || $value === '') { // Default it to true if it's set but null or empty