• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2893

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Checkout

Show Products From Same Taxonomy Term As Single Product – WooCommerce

$75.00

Category: WooCommerce Tags: get_term_by, term_id, term_taxonomy_id, woocommerce_shortcode_products_query, wp_get_post_terms
  • Description

This code modifies the WooCommerce product shortcode so it only displays products from the same taxonomy term as the single product.

The code also handles multiple taxonomies by excluding out of stock products so only products related to the same taxonomy term, which are “in stock”, are shown. And it also removes the current single product from the list avoiding duplicates.

The code also works with plugins like YITH which generate custom taxonomy terms for brands however you can use the code with tax terms generated by code or any other plugin.

Demo Video

On request

Installation

There’s only 1 step :

Copy & paste the PHP code to the end of your child themes functions.php file or custom functionality plugin.

Taxonomy

Swap out all 3 instances of yith_product_brand in the code with the taxonomy slug of your taxonomy.

The code was written to replace the YITH WooCommerce Brands Addon and match existing taxonomy, terms & products used with the plugin.

Primary Sidebar

Guaranteed code

Written by Brad Dalton specialist for WooCommerce. Read More…

Advertise · WPEngine · Genesis · Log in

  • Code Snippets
  • Tutorials
  • Videos
  • Tags
  • Account
  • Checkout
  • Cart
  • Hire Me
 

Loading Comments...
 

You must be logged in to post a comment.