PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.20
ووسلام – همگام سازی ووکامرس و باسلام v1.10.20
1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 All 53 releases
← All changes | includes/Actions/Controller/ProductActions/CreateSingleProduct.php +6 -0 1.10.21.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