Related Products Filter
-
What I’m looking to do is to edit the filter that choose what is considered a Related Product or not.
From reading the WooCommerce docs, on each single product page, a related product is found by adding similar products in the same product category or tags.
Now, that’s all fine and dandy, but since I have a store that has CDs, DVDs, etc. it’s pulling in CDs from totally different genres.
I’m looking to remove the snippit of code that “pulls in” the related products in the same category and want to use JUST the tags.
The furthest I’ve gotten is found the file /woocommerce/templates/single-product/related.php file. Code attached. I believe it pulls it in somewhere here, or pulls in a function from somewhere else that I can’t find.
<?php /** * Related Products * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ global $product, $woocommerce_loop; $related = $product->get_related(); if ( sizeof($related) == 0 ) return; $args = apply_filters('woocommerce_related_products_args', array( 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $posts_per_page, 'orderby' => $orderby, 'post__in' => $related ) ); $products = new WP_Query( $args ); $woocommerce_loop['columns'] = $columns; if ( $products->have_posts() ) : ?> <div class="related products"> <h2><?php _e('Related Products', 'woocommerce'); ?></h2> <ul class="products"> <?php while ( $products->have_posts() ) : $products->the_post(); ?> <?php woocommerce_get_template_part( 'content', 'product' ); ?> <?php endwhile; // end of the loop. ?> </ul> </div> <?php endif; wp_reset_postdata();
I did some searching and I couldn’t find an answer to my solution.
I also picked through the code and haven’t found a solution either.Does anyone have any thoughts on this? I think it would be really helpful for other people since I’ve seen others looking to modify the code themselves as well.
Thanks so much,
M
- The topic ‘Related Products Filter’ is closed to new replies.