Created
July 14, 2020 15:46
-
-
Save growdev/03a5dbeca1a436165a7cc214075c94ad to your computer and use it in GitHub Desktop.
Add data to the Pushover New Order notification
This file contains hidden or 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
<?php | |
/** | |
* Hook into Pushover send notification on new order and add something to the title from order. | |
* | |
* @hook 'wc_pushover_notify_new_order' | |
* @param $args | |
* @return mixed | |
*/ | |
function sp_wc_pushover_notify_new_order( $args ) { | |
if ( isset( $args['order_id'] ) ) { | |
$order_id = $args['order_id']; | |
$meta = get_post_meta( $order_id, '_billing_country', true ); | |
if ( $meta ) { | |
// Add to title | |
$args['title'] .= ' Country is ' . $meta; | |
// Modify the message | |
//$args['message'] = ''; | |
// Modify the URL | |
//$args['url'] = ''; | |
} | |
} | |
return $args; | |
} | |
add_filter( 'wc_pushover_notify_new_order', 'sp_wc_pushover_notify_new_order', 10 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hooks available:
New Order notification (free) -
wc_pushover_notify_free_order
New Order notification -
wc_pushover_notify_new_order
Back order -
wc_pushover_notify_backorder
No Stock -
wc_pushover_notify_no_stock
Low Stock -
wc_pushover_notify_low_stock