Display Convert Plus Module only if Some Specific Cookie is Set

We do not have a default option to display a module only if some specific cookie/cookies are set. But, you can achieve this using target page filter ‘cp_target_page_settings‘ which handles the visibility of a module.

Here is an article for more information.

Here is some reference idea for code how it should work-

function your_callback_function( $display, $style_id ) {
$cookie_name = 'style_id2'; //change the cookie name as per your style id.

// Replace style id with your style ID
if( $style_id == 'cp_id_d3a5b' ) {

// your custom logic
$display = false;

if(isset($_COOKIE[$cookie_name])){
$display = true;
}

}

return $display;
}
add_filter( 'cp_target_page_settings', 'your_callback_function', 10, 3 );

Not sure where you’ll find the style ID?

Go to Design -> Advance Design Options -> Scroll down and find the ID there. Screenshot

Note: You will need to enter the above code in your theme’s functions.php file.

 

Not the solution you are looking for? Check other articles, or open a support ticket.