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

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Checkout
  • Cart
  • Videos

Exclude Upsell Products by Category in WooCommerce

$75.00

Demo Video
Category: WooCommerce
  • Description

This custom upsells loop for WooCommerce enables you to exclude products by category or any other taxonomy. Assuming upsells have already been added using the Linked Products tab in Product Data, you can use the code to remove products in one or more categories by cat id or category slug.

Exclude product category from upsells

Demo Video

The demo video shows 5 products added to Product Data > Linked Products > Upsells tab and only 3 displaying on the front end after the single mproduct as 2 products have been excluded as they belong to the excluded category added in the code on line 34

Installation

Install the Remove Category from Upsells zip folder as a new plugin or copy & paste the PHP code to the end of your child themes functions file or code snippets plugin.

You can then add your excluded taxonomy terms by slug on line 34 of the functions file including a comma separated array if adding more than 1 taxonomy term.

Primary Sidebar

Cart

Code written by Brad Dalton specialist for WooCommerce with more than 10 years of experience.

Advertise · WPEngine · Genesis · Log in

  • Code Snippets
  • Tutorials
  • Videos
  • Account
  • Checkout
  • Cart
 

Loading Comments...
 

You must be logged in to post a comment.