wpf_woocommerce_subscription_status_apply_tags

Overview

This filter is run during a WooCommerce subscription status change, 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
  • $status: The current subscription status (i.e. active, pending-cancel, on-hold)
  • $subscription: The subscription object

Examples

Don’t apply any tags when a subscription status changes to active

This is useful if you need to manually approve new orders and you don’t want any tags applied at checkout that would unlock other content.

function custom_wpf_status_check( $apply_tags, $status, $subscription ) {

	if ( 'active' == $status ) {
		return false;
	}

	return $apply_tags;

}

add_filter( 'wpf_woocommerce_subscription_status_apply_tags', 'custom_wpf_status_check', 10, 3 );

Was this helpful?