Created
February 2, 2016 20:11
-
-
Save abegit/74e691d877cadc37d7b6 to your computer and use it in GitHub Desktop.
WooCommerce Hooks for Order Status Changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mysite_pending($order_id) { | |
error_log("$order_id set to PENDING", 0); | |
} | |
function mysite_failed($order_id) { | |
error_log("$order_id set to FAILED", 0); | |
} | |
function mysite_hold($order_id) { | |
error_log("$order_id set to ON HOLD", 0); | |
} | |
function mysite_processing($order_id) { | |
error_log("$order_id set to PROCESSING", 0); | |
} | |
function mysite_completed($order_id) { | |
error_log("$order_id set to COMPLETED", 0); | |
} | |
function mysite_refunded($order_id) { | |
error_log("$order_id set to REFUNDED", 0); | |
} | |
function mysite_cancelled($order_id) { | |
error_log("$order_id set to CANCELLED", 0); | |
} | |
add_action( ‘woocommerce_order_status_pending’, ‘mysite_pending’); | |
add_action( ‘woocommerce_order_status_failed’, ‘mysite_failed’); | |
add_action( ‘woocommerce_order_status_on-hold’, ‘mysite_hold’); | |
// Note that it’s woocommerce_order_status_on-hold, not on_hold. | |
add_action( ‘woocommerce_order_status_processing’, ‘mysite_processing’); | |
add_action( ‘woocommerce_order_status_completed’, ‘mysite_completed’); | |
add_action( ‘woocommerce_order_status_refunded’, ‘mysite_refunded’); | |
add_action( ‘woocommerce_order_status_cancelled’, ‘mysite_cancelled’); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for your explanation ;)