• Hi, I’m showing “Out of stock” products with this shortcode

    add_shortcode( 'out_of_stock_products', 'bbloomer_out_of_stock_products_shortcode' );
       
    function bbloomer_out_of_stock_products_shortcode() {
     
       $args = array(
          'post_type' => 'product',
          'posts_per_page' => -1,
          'post_status' => 'publish',
          'product_cat' => 'kursus',
          'meta_query' => array(
             array(
                'key' => '_stock_status',
                'value' => 'outofstock',
             )
          ),
          'fields' => 'ids',
       );
        
       $product_ids = get_posts( $args ); 
       $product_ids = implode( ",", $product_ids );
        
       return do_shortcode("[products ids='$product_ids']");
     
    }

    And everything works well, but the products where I set the timer become “sold out” in admin, but don’t appear on the page with my shortcode.
    Also the product is gone from its original category, however, Woocomerce counts it.
    Here’s my page https://broderi.cubittest11.dk/vare-kategori/kursus/
    Can you please help?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Out of stock products issue’ is closed to new replies.