Can the BEAR-WooCommerce Bulk Editor work with N rings of sites?
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from Serg on October 16, 2024, 09:14Hi. Can the plugin work with multiple sites at the same time? For example, I need to change products in 5 different online stores, but in order not to go into each store, I would like to change products in one place.
Hi. Can the plugin work with multiple sites at the same time? For example, I need to change products in 5 different online stores, but in order not to go into each store, I would like to change products in one place.
Quote from Pablo Borysenco on October 16, 2024, 12:26Hello
Unfortunately the plugin does not have such a feature.
Hello
Unfortunately the plugin does not have such a feature.
Quote from Serg on October 22, 2024, 06:03Спасибо! Ваш плагин и без этого очень крутой!
Спасибо! Ваш плагин и без этого очень крутой!
Quote from admin on November 3, 2024, 12:56Hello
Here is one idea: you can use hook 'woobe_before_update_product_field' described here https://bulk-editor.com/document/more-settings-implicit on the main site. In to file functions.php of your main site add next code:
add_filter('woobe_before_update_product_field', function($value, $product_id, $field_key) {
// Data to send
$product_data = [
'id' => $product_id,
'field_key' => $field_key,
'value' => $value,
];// URLs for five sites
$site_urls = [
'https://site1.com/wp-json/custom-endpoint/v1/update-product',
'https://site2.com/wp-json/custom-endpoint/v1/update-product',
'https://site3.com/wp-json/custom-endpoint/v1/update-product',
'https://site4.com/wp-json/custom-endpoint/v1/update-product',
'https://site5.com/wp-json/custom-endpoint/v1/update-product'
];// REST API keys for each site (can be created in WooCommerce > Settings > Advanced > REST API)
$api_keys = [
'consumer_key' => 'ck_your_consumer_key_here',
'consumer_secret' => 'cs_your_consumer_secret_here'
];// Sending data to each site
foreach ($site_urls as $url) {
wp_remote_post($url, [
'method' => 'POST',
'headers' => [
'Authorization' => 'Basic ' . base64_encode($api_keys['consumer_key'] . ':' . $api_keys['consumer_secret']),
'Content-Type' => 'application/json',
],
'body' => json_encode($product_data),
]);
}return $value;
}, 10, 3);
On each receiving site, you need to register a REST API endpoint to process the received data and update products. Add this code to the functions.php file or a separate plugin on each of the five sites.
add_action('rest_api_init', function() {
register_rest_route('custom-endpoint/v1', '/update-product', [
'methods' => 'POST',
'callback' => 'update_product_data',
'permission_callback' => function() {
return current_user_can('edit_products'); // Allows access only to users who can edit products
},
]);
});function update_product_data($request) {
$params = $request->get_json_params();
$product_id = isset($params['id']) ? intval($params['id']) : 0;
$field_key = isset($params['field_key']) ? sanitize_text_field($params['field_key']) : '';
$value = isset($params['value']) ? sanitize_text_field($params['value']) : '';if (!$product_id || !$field_key) {
return new WP_Error('missing_data', 'Product ID or Field Key is missing.', ['status' => 400]);
}// Update the desired product field depending on field_key
switch ($field_key) {
case 'title':
wp_update_post([
'ID' => $product_id,
'post_title' => $value,
]);
break;case 'short_description':
wp_update_post([
'ID' => $product_id,
'post_excerpt' => $value,
]);
break;case 'description':
wp_update_post([
'ID' => $product_id,
'post_content' => $value,
]);
break;default:
// Updating a meta field for custom data
update_post_meta($product_id, $field_key, $value);
break;
}
return new WP_REST_Response('Product updated successfully', 200);
}
We not tested the code, but this idea should work :)
Hello
Here is one idea: you can use hook 'woobe_before_update_product_field' described here https://bulk-editor.com/document/more-settings-implicit on the main site. In to file functions.php of your main site add next code:
add_filter('woobe_before_update_product_field', function($value, $product_id, $field_key) {
// Data to send
$product_data = [
'id' => $product_id,
'field_key' => $field_key,
'value' => $value,
];
// URLs for five sites
$site_urls = [
'https://site1.com/wp-json/custom-endpoint/v1/update-product',
'https://site2.com/wp-json/custom-endpoint/v1/update-product',
'https://site3.com/wp-json/custom-endpoint/v1/update-product',
'https://site4.com/wp-json/custom-endpoint/v1/update-product',
'https://site5.com/wp-json/custom-endpoint/v1/update-product'
];
// REST API keys for each site (can be created in WooCommerce > Settings > Advanced > REST API)
$api_keys = [
'consumer_key' => 'ck_your_consumer_key_here',
'consumer_secret' => 'cs_your_consumer_secret_here'
];
// Sending data to each site
foreach ($site_urls as $url) {
wp_remote_post($url, [
'method' => 'POST',
'headers' => [
'Authorization' => 'Basic ' . base64_encode($api_keys['consumer_key'] . ':' . $api_keys['consumer_secret']),
'Content-Type' => 'application/json',
],
'body' => json_encode($product_data),
]);
}
return $value;
}, 10, 3);
On each receiving site, you need to register a REST API endpoint to process the received data and update products. Add this code to the functions.php file or a separate plugin on each of the five sites.
add_action('rest_api_init', function() {
register_rest_route('custom-endpoint/v1', '/update-product', [
'methods' => 'POST',
'callback' => 'update_product_data',
'permission_callback' => function() {
return current_user_can('edit_products'); // Allows access only to users who can edit products
},
]);
});
function update_product_data($request) {
$params = $request->get_json_params();
$product_id = isset($params['id']) ? intval($params['id']) : 0;
$field_key = isset($params['field_key']) ? sanitize_text_field($params['field_key']) : '';
$value = isset($params['value']) ? sanitize_text_field($params['value']) : '';
if (!$product_id || !$field_key) {
return new WP_Error('missing_data', 'Product ID or Field Key is missing.', ['status' => 400]);
}
// Update the desired product field depending on field_key
switch ($field_key) {
case 'title':
wp_update_post([
'ID' => $product_id,
'post_title' => $value,
]);
break;
case 'short_description':
wp_update_post([
'ID' => $product_id,
'post_excerpt' => $value,
]);
break;
case 'description':
wp_update_post([
'ID' => $product_id,
'post_content' => $value,
]);
break;
default:
// Updating a meta field for custom data
update_post_meta($product_id, $field_key, $value);
break;
}
return new WP_REST_Response('Product updated successfully', 200);
}
We not tested the code, but this idea should work :)