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

WP SITES

2765

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Shop
  • Checkout
  • Cart

Multiple Related Product Loops Based On Stock Status – WooCommerce

$300.00

— OR —

  • Description

Description

This downloadable product includes 3 custom product loops which display based on the stock status of the current single product.

  • If the single product is Out of Stock ( OOS ), Loop 1 displays before the product and Loop 2 & Loop 3 display after the product.
  • If the single product is In Stock, Loop 2 & Loop 3 display after the product.
  • Both Loop 1 & Loop 2 display related products by category however you can easily change this to tag.
  • Loop 3 displays products by brand regardless of category. Code is included to create a brand using the taxonomy slug yith_product_brand
  • All loops only display in stock ( IS ) products.
  • All loops compare product IDS and remove duplicate products.

By default, Loop 1 displays 4 products, Loop 2, 16 products and Loop 3, 8 products.

Out of Stock Single Product
Out of Stock Single Product
In Stock Single Product
In Stock Single Product

You can easily position any loop using one of the single product page hooks

Live Demo

On request

Installation

There’s only 1 step :

Copy & paste the PHP code ( excluding the opening PHP tag ) from the functions.php file to the end of your child themes functions file or custom functionality plugin.

* If you already use a plugin or code to add taxonomy terms & term meta, only copy the code starting from line 83 in functions.php.

Note : Make sure you go to WooCommerce > Status > Tools to clear transients. Also clear all types of caching once you have installed the code or made changes.

Primary Sidebar

Cart

Advertise · WPEngine · Genesis · Log in

  • Account
  • Checkout
  • Cart
 

Loading Comments...
 

You must be logged in to post a comment.