Order Sync for WooCommerce: Hook Reference
rudr_wos_is_auto_mode
By, default, you can turn on or turn off order auto-syncing in the plugin settings:

However, this filter hook allows you to define auto-syncing for some specific orders only.
$is_auto_mode = apply_filters( 'rudr_wos_is_auto_mode', $is_auto_mode, $order );- $is_auto_modebool
- Whether order auto-syncing is allowed (
true) or not (false). - $orderWC_Order
- An order object.
Example. Force allowing auto-syncing in 2-ways sync for specific stores
Let’s assume, we have “Store 1” and “Store 2”. The plugin is installed on both of them. Orders are getting synced automatically from “Store 2” to “Store 1”, however, one of the requirements is that “Store 1” has the “Auto mode” option turned off.
How can we automatically sync changes in orders from “Store 1” back to “Store 2”? But, at the same time, orders created on “Store 1” directly shouldn’t be synced automatically.
Let’s do it with a simple code snippet, which must be installed on “Store 1”:
add_filter( 'rudr_wos_is_auto_mode', function( $is_auto_mode, $order ) {
// the custom field contains a source store URL without http:// or https://
$source = $order->get_meta( '_wc_order_attribution_utm_source' );
if( 'store2.rudrastyh.com' === $source ) {
$is_auto_mode = true;
}
// multiple store conditions can go here as well
// if( 'store3.rudrastyh.com' === $source ) {
// $is_auto_mode = true;
// }
return $is_auto_mode;
}, 25, 2 );rudr_wos_get_stores
Allows you to filter available stores when syncing a specific order.
$stores = apply_filters( 'rudr_wos_get_stores', $stores, $order );- $orderWC_Order
- An order object.
Example. Allow a specific order to be synced only to one particular store
add_filter( 'rudr_wos_get_stores', function( $stores, $order ) {
// for example, it is an order with a specific custom field
if( ! $order->get_meta( 'specific-custom-field' ) ) {
return $stores;
}
// we can filter an array with stores like this
$url = 'https://store2.rudrastyh.com'; // target store URL
$stores = array_filter( $stores, function( $store ) use ( $url ) {
return $url === $store[ 'url' ];
} );
return $stores;
}, 25, 2 );rudr_wos_pre_update_order_data
Allows you to change the order data before it gets created or updated on the target store.
$order_data = apply_filters( 'rudr_wos_pre_update_order_data', $order_data, $order, $store_url, $action );- $order_dataarray
- Contains all the order data that is going to be synced.
- $orderWC_Order
- The original order object.
- $store_urlstring
- The target store URL.
- $actionstring
create– when creating a new order,update– when an order has already been synced and currently is being updated.
Example. Do not reduce order stock for new processing orders
By default, when you sync new orders with statuses “Processing” or “Completed”, WooCommerce performs stock recalculation. However, you can turn it off using a hook:
add_filter( 'rudr_wos_pre_update_order_data', function( $order_data ) {
if( ! empty( $order_data[ 'set_paid' ] ) ) {
unset( $order_data[ 'set_paid' ] );
}
return $order_data;
} );