WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Hide WooCommerce out of stock product attribute items (2 posts)

  1. codenegar
    Member
    Posted 1 year ago #

    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/

  2. Roy Ho
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic