WordPress.org

Support

Support » Plugins and Hacks » Hide WooCommerce out of stock product attribute items

Hide WooCommerce out of stock product attribute items

  • I’ve created an attribute for WooCommerce products: size, it has three items, size1, size2 and size3. I can use

    get_terms('pa_size', 'orderby=name&hide_empty=1');
    to get size attribute items. Now size3 is out of stock but get_terms function returns it. How can I get only items that are in stock(only size1 and size2)?
    Thanks.

    http://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Roy Ho

    @splashingpixelscom

    I believe stock status is a post meta so instead of using get_terms, you may need to use WP_Query so you can use meta query.

Viewing 1 replies (of 1 total)
  • The topic ‘Hide WooCommerce out of stock product attribute items’ is closed to new replies.