[Resolved] Redirection for default woocommerce shop page

Home Forums Support [Resolved] Redirection for default woocommerce shop page

Home Forums Support Redirection for default woocommerce shop page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #129869
    stardrive

    Dear Support,

    Please, I noticed that the redirection function you gave me is working for other pages but is not working for the default woocommerce shop page: It does not redirect from the woocommerce shop page to my custom shop page.
    See the code below:

    function custom-shop_page_redirect()
    {
    if( is_page( 680 ) )
    {
    wp_redirect( home_url( ‘/custom-shop-page/’ ) );
    exit();
    }
    }
    add_action( ‘template_redirect’, ‘custom-shop_page_redirect’ );

    Please, kindly assist.

    Regards,

    Stardrive

    #129888
    Jean Paiva
    Developer

    That’s not working because is_page() is a WordPress function and do not call the woocommerce pages, you just need to change it for: is_woocommerce( 680 ).

    Should work now!

    #129932
    stardrive

    Great!!

    It is OK now. Thank you, Jean.

    Regards,

    Stardrive

    #129943
    Jean Paiva
    Developer

    Great! 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.