Forum Replies Created

Viewing 1 replies (of 1 total)
  • Well there is a workaround.
    Yes, I know it’s a bit ugly but it has a great advantage – it works, at least for me.
    1) navigate to /wp-content/plugins/woocommerce/classes/ and make backup of class-wc-shortcodes.php
    2) edit class-wc-shortcodes.php go to function product_attribute( $atts ) {
    in my case it is line #966
    to the following code

    $args = array(
    			'post_type'           => 'product',
    			'post_status'         => 'publish',
    			'ignore_sticky_posts' => 1,

    add the following line
    'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1,

    so the whole array initialization looks like the following

    $args = array(
    			'post_type'           => 'product',
    			'post_status'         => 'publish',
    			'ignore_sticky_posts' => 1,
    			'paged'								=> (get_query_var('paged')) ? get_query_var('paged') : 1,
    			'posts_per_page'      => $per_page,
    			'orderby'             => $orderby,
    			'order'               => $order,
    			'meta_query'          => array(
    				array(
    					'key'               => '_visibility',
    					'value'             => array('catalog', 'visible'),
    					'compare'           => 'IN'
    				)
    			),
    			'tax_query' 			=> array(
    				array(
    					'taxonomy' 	=> $attribute,
    					'terms' 	=> $filter,
    					'field' 	=> 'slug'
    				)
    			)
    		);

    3) change the line #1020
    <?php woocommerce_product_loop_end(); ?>
    to the following

    <?php woocommerce_product_loop_end();
    				global $wp_query;
    				$wp_query->max_num_pages = $products->max_num_pages;
    							woocommerce_pagination();
    			?>

    Again, yes I know that solution can be more elegant, I just don’t need it.

Viewing 1 replies (of 1 total)