• Resolved 1callservice

    (@1callservice)


    Woocommerce seems to be incorrectly adding the “instock” class to some products that are actually On Backorder (stock below zero)…

    On this example, the OB-122 cue is showing class=”instock” but when you click on it it says Available On Backorder…. in fact this product’s stock is negative 8…

    Why is Woocommerce doing instock class on this item if it’s not in stock?

    I already cleared the w3tc caches, it’s not that

    • This topic was modified 5 years, 10 months ago by 1callservice.
    • This topic was modified 5 years, 10 months ago by 1callservice.

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Have you tried switching themes as well? What version of WC & WP are you running?

    Thread Starter 1callservice

    (@1callservice)

    It’s the Storefront theme maintained by Woocommerce. Latest version of everything.

    Good. Okay. And no other plugins that manage inventory? Howabout a Shipping party integration? Like Ship Easy or Stamps.com? Nothing that sends back a call to your inventory?

    Thread Starter 1callservice

    (@1callservice)

    Yes we have Quickbooks integration via MyWorks that maintains inventory levels with our QB.

    Ok great. More information. Beautiful. Is it possible to disable the inventory portion of QB and test? I haven’t worked with the QB inventory in quite awhile. We used to have to use a 3rd party plugin just to get QB to work with WC for that.

    Thread Starter 1callservice

    (@1callservice)

    i just checked and the _stock_status meta value for this product is indeed “instock”, but the _stock meta value is -8 so idk why it’s still doing “instock”…

    i suppose i will add my own filter for showing the instock/backorder icon overlay using the _stock instead of _stock_status based class woocommerce adds.

    Thanks

    • This reply was modified 5 years, 10 months ago by 1callservice.
    Thread Starter 1callservice

    (@1callservice)

    i was able to create a workaround using the actual stock counts, marking this as resolved.

    function customstockclassinloop( $classes ) {
        global $post;
        if(floatval(get_post_meta($post->ID,"_stock",true)) > 0){
        	$classes[]='obcuesinstock';
        }else{
        	if(get_post_meta($post->ID,"_backorders",true) == "yes" || get_post_meta($post->ID,"_backorders",true) == "notify"){
        		$classes[]='obcuesbackorder';
        	}else{
        		$classes[]='obcuesoutofstock';
        	}
        }
    
        return $classes;
    }
    add_filter( 'post_class', 'customstockclassinloop' );

    Glad to hear it. Great job!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘catalog not showing stock correctly’ is closed to new replies.