Remove FoxyCart Includes From a Specific Page

Note, as of FoxyShop 3.9. this feature is built-in. Visit the settings page to manage this.

If you are using FoxyCart’s template caching functionality and want to remove the FoxyCart headers from a specific page (like the checkout or receipt page), paste the following code into your functions.php file:

add_action('wp_head', 'my_remove_foxycart_headers', 1);
function my_remove_foxycart_headers() {
	$no_include_pages = array(
		'page-slug',
		'page-slug-2'
	);
	if (is_page($no_include_pages)) {
		remove_action('wp_head', 'foxyshop_insert_foxycart_files');
	}
}

The $no_include_pages array should list out the slugs or ID’s of all the pages where the FoxyCart includes should not be inserted.

Posted in: Helpful Code Snippets