WooCommerce: need hook when admin manually creates

2019-02-05 15:42发布

One of my sites uses WooCommerce. The client wants to manually create orders occasionally from within order admin (WooCommerce > Orders > Add Order). I need to do some additional processing on the order when they click "Save Order" on that page.

Is there a hook available for that? I've looked through the WooCommerce documentation and list of hooks but found nothing.

2条回答
霸刀☆藐视天下
2楼-- · 2019-02-05 16:31

It looks like woocommerce_process_shop_order_meta will work for me,

add_action( 'woocommerce_process_shop_order_meta', 'woocommerce_process_shop_order', 10, 2 );
function woocommerce_process_shop_order ( $post_id, $post ) {
        // my code here
}
查看更多
别忘想泡老子
3楼-- · 2019-02-05 16:40

I've recently found that WooCommerce documentation is basically non-existent in a practical sense. However, have you tried either the woocommerce_admin_order_actions_end or woocommerce_admin_order_actions_start hooks?

查看更多
登录 后发表回答