• Hello,

    Thank you for this great plugin!

    I use Divi theme and I have the following problem.

    Plugin works fine in Shop page, but in product category pages, only the switch from grid to list works. Changing the number of products per page has no effect. Page reloads but always displays the number of products set under Divi’s options.

    I wonder if anyone faced this problem before and if he manged to fix it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Ilias Antonopoulos

    (@elias69)

    Hi,

    I’ve found a solution to this problem. Perhaps not the best, but it works.
    Unfortunately you have to modify a plugin’s core file.

    Grid/List View for WooCommerce, Version: 1.1.0.2
    File main.php
    Line 283

    Original code:

    
    public function set_pre_get_posts($query) {
    if( ! is_admin() && $query->is_main_query() && class_exists( 'WooCommerce' ) && function_exists( 'wc_get_page_id' ) && is_post_type_archive( 'product' ) ) {
                $count = $this->set_products_per_page(false);
                if( $count !== false ) {
                    $query->set('posts_per_page', $count);
                }
            }
    }
    

    Change to:

    
    public function set_pre_get_posts($query) {
    if( ! is_admin() && $query->is_main_query() && class_exists( 'WooCommerce' ) && function_exists( 'wc_get_page_id' ) && (is_post_type_archive( 'product' ) || is_product_category()) ) {
                $count = $this->set_products_per_page(false);
                if( $count !== false ) {
                    $query->set('posts_per_page', $count);
                }
            }
    }
    

    What I did, is to check not only if it is trying to show products, but also if it is trying to show a product’s category.

    Now plugin works great with Divi theme.

    Plugin Author RazyRx

    (@razyrx)

    Hi @elias69,

    Thank you for solution. We will add it in next plugin release.

    Regards,
    Oleg

    Thread Starter Ilias Antonopoulos

    (@elias69)

    You are welcome Oleg.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Grid/List View for WooCommerce and Divi Theme’ is closed to new replies.