WooCommerce – Hide product is restricted to members of WooCommerce Memberships plugin

Content Views Pro helps you to show any WooCommerce products easily.

This document is used to hide product is restricted to members of WooCommerce Memberships plugin.

Please add this code to file functions.php in the theme’s folder (or install this plugin Code Snippets then add this code to the “Code” textarea):

// Content Views Pro - Hide product is restricted to members of WooCommerce Memberships
add_filter( 'pt_cv_show_this_post', 'cvp_theme_support_woomembership', 100, 1 );
function cvp_theme_support_woomembership( $args ) {
	if ( wc_memberships_is_product_viewing_restricted( $args->ID ) || wc_memberships_is_post_content_restricted( $args->ID ) ) {
		$args = 0;
	}
	return $args;
}

Best regards,