Get the count of all “In stock” products in WooCommerce
问题 I have a site where products are considered trade/deal. Therefore, when someone take a trade (buy a product), it become out of stock. What would be the PHP snippet to display the remaining numbers of product currently available (basically In Stock) ? ex: Hurry Up! Only 10 trades (woocommerce -> products) available! Thanks in advance! I tried the code provided : function fp2() { global $wpdb; $stock = get_post_meta( $post->ID, '_stock', true ); echo '<span style="color:#fff;text-align:center