Support » Plugin: WooCommerce » Disable noindex on certain core pages

  • Hi!

    So, I would like to know how to override a default behavior in Woocommerce, which is caused by the following code:

    function wc_page_noindex() {
    	if ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) || is_page( wc_get_page_id( 'myaccount' ) ) ) {
    add_action( 'wp_head', 'wc_page_noindex' );

    This code blocks core pages from being detected by search engines. Problem is: my configuration puts the checkout and cart page right on the home page using Woocommerce One Page Checkout plugin. Essentially, this is the most important page on the site and yet because it has a checkout and cart, it is automatically being label “noindex”. The independent checkout page will not be used at all as a result. How can I address this? I do not care if the independent “cart” and “checkout” pages are not seen but I would like the “my account” page to also be indexed as I classify it as an important page for customers.

    Appreciate any help!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mike Jolley


    remove_action( 'wp_head', 'wc_page_noindex' );

    in your theme functions.php file should do it.

    Thank you for getting back to me with a solution Mike.

    Sadly, it didn’t seem to work. I’m still getting “<meta name=’robots’ content=’noindex,follow’ />”.


    Plugin Support Dustin Hartzler


    Automattic Happiness Engineer

    Did you add the code via the functions.php file?

    Are other functions in that file working correctly?

    Hi Dustin!

    Yes, I have a lot of functions in that file and all are working just fine. I deactivated Yoast just in case. Unfortunately no change.

    The moment I disable Woocommmerce however, it goes away.

    Austin Ginder


    I was having similar issues. I was able to get it removed using the following within my theme’s functions.php file.

    add_action( 'init', 'remove_wc_page_noindex' );
    function remove_wc_page_noindex(){
    	remove_action( 'wp_head', 'wc_page_noindex' );
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.