Skip to content

Instantly share code, notes, and snippets.

@verygoodplugins
Last active April 7, 2017 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save verygoodplugins/56d4a1cbc91821cf6768d93017fa5af0 to your computer and use it in GitHub Desktop.
Save verygoodplugins/56d4a1cbc91821cf6768d93017fa5af0 to your computer and use it in GitHub Desktop.
Applies tags to users when order is placed On Hold (cheque payments)
<?php
// Applies tags to users when order is placed On Hold (cheque payments)
add_action( 'woocommerce_order_status_on-hold', 'custom_wpf_woo_on_hold' );
function custom_wpf_woo_on_hold( $order_id ) {
$order = new WC_Order( $order_id );
$user = get_user_by( 'email', $order->billing_email );
// Change 123 to the tag ID to be applied
wp_fusion()->user->apply_tags(array(123), $user->ID);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment