Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter andy35

    (@andy35)

    I found the issue causing this problem. This is for Damian, Clint and all who are facing this same problem.

    The issue was a code snippet that was in Divi’s child theme “Wardrobe for Divi”. In child theme’s functions.php file had the following code:

    function custom_shop_page_redirect() {
        if( is_shop() ){
            wp_redirect( home_url( '/' ) );
            exit();
        }
    }
    add_action( 'template_redirect', 'custom_shop_page_redirect' );

    What this suppose to do is that it redirects the common shop page domain.com/shop (displaying all products) to front page. The problem is that it also affects to search result page, which is filtered only to products.

    First workaround for this is to remove the whole snippet. If you still want to redirect the common shop page, another workaround is to edit the if-statement line to be this:
    if( is_shop() && ! is_search() ) {

    I didn’t design the client’s web shop (I’m just modifying it), so I don’t know if this code snippet is originally there or did the client’s web shop developer add it. So I also don’t know if the original web shop developer need to be slapped on the back of the head or the child theme’s developers. It took me 6-8 hours to solve this.

    Hope this helps someone.

    • This reply was modified 5 years ago by andy35. Reason: spell correcting
    Thread Starter andy35

    (@andy35)

    Hi Clint and Damian!

    Thank you for your response. It indeed seems to be a redirect issue. I found out that the problem occurs when the search has the parameter post_type=product. Without it the search results are displaying fine.

    I’m not the original developer of the website and I don’t have the FTP credentials, so I can’t read the .htaccess file. I presume there would be some explanations of redirects, if those are done by some plugin. Now I’m waiting my client to send me FTP credentials so I can investigate this further.

    But it’s certain that this is not related to your plugin so you can mark this as solved. For now it seems that this is related to Divi theme (or it’s child theme “Wardrobe for Divi”). I switched to another theme and the problem didn’t occur.

    I’ll investigate further and if I find the source of the issue, I’ll post it here. It may help you guys or other Divi users. Thank you for your help.

Viewing 2 replies - 1 through 2 (of 2 total)