← All changes
|
includes/Services/Products/UpdateSingleProductService.php
+7
-0
1.10.22
→
1.10.28
View file →
| @@ -241,8 +241,12 @@ | ||
| 241 | 241 | // one-to-one mapping is unambiguous and safe in that case. |
| 242 | 242 | if (count($variations) === 1 && count($body['variants']) === 1 && !empty($body['variants'][0]['id'])) { |
| 243 | 243 | update_post_meta($variations[0], 'sync_basalam_variation_id', $body['variants'][0]['id']); |
| 244 | 244 | } |
| 245 | + | |
| 246 | + if ($product instanceof \WC_Product_Variable) { | |
| 247 | + (new VariantService())->syncExpandedVariationIds($product, $body['variants']); | |
| 248 | + } | |
| 245 | 249 | } |
| 246 | 250 | } |
| 247 | 251 | |
| 248 | 252 | return $this->finishUpdate($productId, $body, 'فرایند بروزرسانی محصول با موفقیت انجام شد.'); |
| @@ -314,8 +318,11 @@ | ||
| 314 | 318 | // been built. If the following API request fails, the next job retries |
| 315 | 319 | // the safe full-product remapping path instead of the stale endpoint. |
| 316 | 320 | foreach ($product->get_children() as $variationId) { |
| 317 | 321 | delete_post_meta($variationId, 'sync_basalam_variation_id'); |
| 322 | + if (get_post_meta($variationId, 'sync_basalam_variation_map', true)) { | |
| 323 | + delete_post_meta($variationId, 'sync_basalam_variation_map'); | |
| 324 | + } | |
| 318 | 325 | } |
| 319 | 326 | |
| 320 | 327 | $productData['variants'] = $variants; |
| 321 | 328 | |