exspet
exspet

Reputation: 58

Set Author for orders while creating at Woocommerce

I'm creating custom multi vendor script in my website. I've set authors (vendors) for woocommerce products and I want to set authors for orders too so I can determine which vendor's product sold.

I'm programmatically creating amazon and other market's orders so I can't use woocommerce thankyou function.

Simply I want to ask, how to hook into woocommerce order save function both works in frontend and backend?

Upvotes: 0

Views: 315

Answers (1)

Mtxz
Mtxz

Reputation: 3869

  • You can try woocommerce_new_order (see).
  • You can also use order status based hooks, like woocommerce_order_status_completed or woocommerce_order_status_changed
  • woocommerce_checkout_create_order, woocommerce_checkout_create_order or woocommerce_payment_complete would be for checkout actions only (see)

All those hooks have the Order or order_id as a parameter or the new order status.

Upvotes: 1

Related Questions