Sync to Probo Action
August 7, 2025 ยท AI Conversations
User
add new action in Order action dropdown in wordpress woocmmerce admin order detail page names "Sync to Probo"
using class
using class
Assistant
To add a new **"Sync to Probo"** action in the **Order actions dropdown** in the WooCommerce **admin order detail page**, you can hook into WooCommerce using the `woocommerce_order_actions` and `woocommerce_order_action_{$action}` hooks.
Here is a full example using a class-based approach:
—
### โ Add this to your custom plugin or theme's `functions.php`:
class WC_Probo_Sync_Action {
public function __construct() {
add_filter('woocommerce_order_actions', [$this, 'add_probo_order_action']);
add_action('woocommerce_order_action_sync_to_probo', [$this, 'handle_probo_sync']);
}
/**
* Add "Sync to Probo" action to order action dropdown
*/
public function add_probo_order_action($actions) {
$actions['sync_to_probo'] = __('Sync to Probo', 'your-textdomain');
return $actions;
}
/**
* Handle the action when triggered
*/
public function handle_probo_sync($order) {
if (!$order instanceof WC_Order) {
return;
}
// Your API call logic here
$order_id = $order->get_id();
// Example log or action
error_log("Probo Sync initiated for order #$order_id");
// Optional: Add a note to order
$order->add_order_note('Order synced to Probo successfully.');
}
}
// Initialize the class
new WC_Probo_Sync_Action();
—
### ๐ Result:
– A new **"Sync to Probo"** option appears in the **Order actions** dropdown (in the right panel of the admin order edit screen).
– On selection, it triggers the logic in `handle_probo_sync()`, where you can place your API call to Probo.
—
Let me know if you want it to auto-run on certain order status, or show on bulk actions too.