Changes on archive-product.php doesn't work

前端 未结 6 584
栀梦
栀梦 2021-01-04 01:49

I\'m trying to customize the standard woocommerce theme and so far that has worked well. I copied all template files from /plugins/woocommerce/templates to

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-04 02:14

    Seems this is STILL an issue in Woocommerce. For anyone landing here, the following solution was working for me as of version 2.1.6.

    Apparently the problem is due to the function woocommerce_content() outputting the wrong page for archive content.

    I used the following to get around it:

    replace woocommerce_content() in woocommerce.php with:

    if ( is_singular( 'product' ) ) {
     woocommerce_content();
    }else{
    //For ANY product archive.
    //Product taxonomy, product search or /shop landing
     woocommerce_get_template( 'archive-product.php' );
    }
    

    Credit: found the solution here

提交回复
热议问题