• WooCommerce changed the way it stores catalog visibility since the last time the plugin was updated. With a quick edit to one file, you can (as of October 2022) get it working again.

    Edit this file:

    wp-content/plugins/woocommerce-sold-out-products/classes/class-wc-sold-out-products.php

    Remove or comment out this block of code that starts on line 64:

    		$meta_query[] = array(
    			'key'     => '_visibility',
    			'value'   => array( 'visible', 'catalog' ),
    			'compare' => 'IN'
    		);

    Replace the $args definition starting on line 95 with the code below (the tax_query portion is the new piece):

    		$args = array(
    			'post_type'	=> 'product',
    			'post_status' => 'publish',
    			'ignore_sticky_posts'	=> 1,
    			'posts_per_page' => $per_page,
    			'orderby' => $orderby,
    			'order' => $order,
    			'meta_query' => $meta_query,
    			'tax_query'   => array( array(
    				'taxonomy'  => 'product_visibility',
    				'terms'     => array( 'exclude-from-catalog' ),
    				'field'     => 'name',
    				'operator'  => 'NOT IN',
    			) )
    		);
  • The topic ‘Instructions to get the plugin working again’ is closed to new replies.