Skip to content

Commit 50ecc65

Browse files
- remove the category sync
1 parent afcc459 commit 50ecc65

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed

src/Main.php

+23-22
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Rnoc\Retainful\Api\AbandonedCart\RestApi;
1212
use Rnoc\Retainful\Api\Imports\Imports;
1313
use Rnoc\Retainful\Api\Imports\Products;
14-
use Rnoc\Retainful\Api\Imports\Category;
14+
//use Rnoc\Retainful\Api\Imports\Category;
1515
use Rnoc\Retainful\Api\NextOrderCoupon\CouponManagement;
1616
use Rnoc\Retainful\Api\Popup\Popup;
1717
use Rnoc\Retainful\Integrations\AfterPay;
@@ -109,16 +109,16 @@ function registerSyncEndPoints() {
109109
'permission_callback' => '__return_true',
110110
'callback' => array($product, 'getSyncProductCount')
111111
));
112-
register_rest_route('retainful-api/v1', '/category/count', array(
113-
'methods' => 'GET',
114-
'permission_callback' => '__return_true',
115-
'callback' => array(Category::class, 'getCategoryCount')
116-
));
117-
register_rest_route('retainful-api/v1', '/category', array(
118-
'methods' => 'GET',
119-
'permission_callback' => '__return_true',
120-
'callback' => array(Category::class, 'getCategory')
121-
));
112+
// register_rest_route('retainful-api/v1', '/category/count', array(
113+
// 'methods' => 'GET',
114+
// 'permission_callback' => '__return_true',
115+
// 'callback' => array(Category::class, 'getCategoryCount')
116+
// ));
117+
// register_rest_route('retainful-api/v1', '/category', array(
118+
// 'methods' => 'GET',
119+
// 'permission_callback' => '__return_true',
120+
// 'callback' => array(Category::class, 'getCategory')
121+
// ));
122122

123123
}
124124

@@ -377,10 +377,10 @@ function activateEvents() {
377377
), 50, 2 );
378378
$product = new Products();
379379

380-
add_filter( 'woocommerce_valid_webhook_resources',function($resources){
381-
$resources[] = 'category';
382-
return $resources;
383-
});
380+
// add_filter( 'woocommerce_valid_webhook_resources',function($resources){
381+
// $resources[] = 'category';
382+
// return $resources;
383+
// });
384384

385385
//add_action('woocommerce_update_order', array($checkout, 'orderUpdated'), 10, 1);
386386
add_filter( 'woocommerce_webhook_http_args',function( $http_args, $order_id, $webhook_id) use ($product,$checkout){
@@ -390,9 +390,10 @@ function activateEvents() {
390390
try {
391391
$webhook = new \WC_Webhook( $webhook_id );
392392
$topic = $webhook->get_topic();
393-
if(preg_match("/category/i", $topic)) {
394-
$http_args = Category::changeWebHookHeaderCategory( $http_args, $order_id, $webhook_id);
395-
}elseif (preg_match("/order/i", $topic)){
393+
// if(preg_match("/category/i", $topic)) {
394+
// $http_args = Category::changeWebHookHeaderCategory( $http_args, $order_id, $webhook_id);
395+
// }else
396+
if (preg_match("/order/i", $topic)){
396397
$http_args = $checkout->changeWebHookHeader( $http_args, $order_id, $webhook_id);
397398
}elseif (preg_match("/product/i", $topic)){
398399
$http_args = $product->changeWebHookHeaderProduct( $http_args, $order_id, $webhook_id);
@@ -405,10 +406,10 @@ function activateEvents() {
405406

406407

407408

408-
add_action('created_product_cat', [Category::class,'createCategory'], 10, 2);
409-
add_action('edited_product_cat', [Category::class,'updateCategory'], 10, 2);
410-
add_action('delete_product_cat', [Category::class,'deleteCategory'], 10, 2);
411-
add_action('retainful_category', [Category::class, 'categoryCallback'], 10, 2);
409+
// add_action('created_product_cat', [Category::class,'createCategory'], 10, 2);
410+
// add_action('edited_product_cat', [Category::class,'updateCategory'], 10, 2);
411+
// add_action('delete_product_cat', [Category::class,'deleteCategory'], 10, 2);
412+
// add_action('retainful_category', [Category::class, 'categoryCallback'], 10, 2);
412413

413414
//Todo: multi currency and multi lingual
414415
//add_action('wp_login', array($this->abandoned_cart_api, 'userCartUpdated'));

src/admin/Settings.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -852,15 +852,15 @@ function createWebhook()
852852
if (isset($hook_status['product.deleted']) && !$hook_status['product.deleted']) {
853853
$this->addNewWebHook('product.deleted');
854854
}
855-
if (isset($hook_status['category.updated']) && !$hook_status['category.updated']) {
856-
$this->addNewWebHook('category.updated');
857-
}
858-
if (isset($hook_status['category.created']) && !$hook_status['category.created']) {
859-
$this->addNewWebHook('category.created');
860-
}
861-
if (isset($hook_status['category.deleted']) && !$hook_status['category.deleted']) {
862-
$this->addNewWebHook('category.deleted');
863-
}
855+
// if (isset($hook_status['category.updated']) && !$hook_status['category.updated']) {
856+
// $this->addNewWebHook('category.updated');
857+
// }
858+
// if (isset($hook_status['category.created']) && !$hook_status['category.created']) {
859+
// $this->addNewWebHook('category.created');
860+
// }
861+
// if (isset($hook_status['category.deleted']) && !$hook_status['category.deleted']) {
862+
// $this->addNewWebHook('category.deleted');
863+
// }
864864
} else {
865865
$this->removeWebhook();
866866
}

0 commit comments

Comments
 (0)