#Overview
This filter is run during a WooCommerce checkout, before WP Fusion has applied any tags to the customer. It can be used to modify the tags that will be applied to the customer. To use the code examples below, add them to your active theme’s functions.php file.
#Parameters
$apply_tags
: This is an array of tags that will be applied to the customer$order
: The WooCommerce order object
#Examples
#Apply an additional tag if the order value is over $100
function high_value_tag( $apply_tags, $order ) {
if ( $order->get_total() > 100 ) {
$apply_tags[] = 'High value customer';
}
return $apply_tags;
}
add_filter( 'wpf_woocommerce_apply_tags_checkout', 'high_value_tag', 10, 2 );
#Force re-apply tags with every renewal order
By default WP Fusion does not re-apply the tags applied at checkout with every WooCommerce Subscriptions renewal order, because in most cases the tags haven’t changed.
This example forces the tags to be re-applied with every renewal payment.
function force_reapply_tags_on_renewal() {
remove_filter( 'wpf_woocommerce_apply_tags_checkout', array( wp_fusion()->integrations->{'woo-subscriptions'}, 'maybe_skip_tags_on_renewal' ) );
}
add_action( 'wp_fusion_init', 'force_reapply_tags_on_renewal' );
Was this helpful?
Let us know if you liked the post. That’s the only way we can improve.