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 8 months 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
    Member
    Posted 8 months 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.

Reply

You must log in to post.

About this Plugin

About this Topic