Skip to content

Instantly share code, notes, and snippets.

@growdev
Created July 14, 2020 15:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save growdev/03a5dbeca1a436165a7cc214075c94ad to your computer and use it in GitHub Desktop.
Save growdev/03a5dbeca1a436165a7cc214075c94ad to your computer and use it in GitHub Desktop.
Add data to the Pushover New Order notification
<?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 );
@growdev
Copy link
Author

growdev commented Jul 14, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment