← All changes
|
includes/Actions/Controller/ProductActions/CreateSingleProduct.php
+6
-0
1.10.2
→
1.10.20
View file →
| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | use SyncBasalam\Admin\Product\ProductOperations; |
| 6 | 6 | use SyncBasalam\Actions\Controller\ActionController; |
| 7 | 7 | use SyncBasalam\Logger\Logger; |
| 8 | +use SyncBasalam\Services\VendorSyncPolicy; | |
| 8 | 9 | |
| 9 | 10 | defined('ABSPATH') || exit; |
| 10 | 11 | |
| 11 | 12 | class CreateSingleProduct extends ActionController |
| @@ -11,8 +12,13 @@ | ||
| 11 | 12 | class CreateSingleProduct extends ActionController |
| 12 | 13 | { |
| 13 | 14 | public function __invoke() |
| 14 | 15 | { |
| 16 | + $vendorSyncPolicy = syncBasalamContainer()->get(VendorSyncPolicy::class); | |
| 17 | + if (!$vendorSyncPolicy->canCreate()) { | |
| 18 | + return wp_send_json_error(['message' => $vendorSyncPolicy->getRestrictionMessage(false)], 409); | |
| 19 | + } | |
| 20 | + | |
| 15 | 21 | $productOperations = syncBasalamContainer()->get(ProductOperations::class); |
| 16 | 22 | |
| 17 | 23 | $productId = isset($_POST['product_id']) ? sanitize_text_field(wp_unslash($_POST['product_id'])) : null; |
| 18 | 24 | |