Bricks Condition for WishList Member

Looking to render a Bricks builder element only if the user has access to a specified WishList Member level?

Just add this in child theme‘s functions.php or a code snippets plugin:

// Function to check if WooCommerce cart is empty.
function bl_is_cart_empty() {
	if ( function_exists( 'WC' ) ) {
		return WC()->cart->is_empty();
	}

	return true;
}
// Function to check if the current user belongs to the specified WishList Member level.
function bl_user_has_wlm_level( $level ) {
	return wlmapi_is_user_a_member( $level, get_current_user_id() );
}

and apply a dynamic condition like this:

{echo:bl_user_has_wlm_level(1679020379)}

where 1679020379 is the ID of the membership level.

Reference

https://wishlistmember.com/docs/knowledge-base/function-reference-wlmapi_is_user_a_member/

Get full access to all 220+ Bricks tutorials with BricksLabs Pro

Leave the first comment