0

I am using the Barn2 Product Table plugin with WooCommerce. I would like to modify the main query so that only products with a certain attribute are displayed (depending on the logged in user)

I am using wc_product_table_query_args. To make it display products from a certain category is no problem and the following arguments work:

$query['tax_query'][] = array(
        'taxonomy' => 'product_cat',
        'field'    => 'slug',
        'terms' => array( 'sweatshirts' ),
        'operator' => 'IN',
);

However, I would like to change this so it works with an attribute instead of category e.g. where attribute name = Color, and attribute value = Red.

Any help is much appreciated, thanks.

1 Answer 1

-1

You can do it with WOOT: https://products-tables.com/shortcode/woot/ - create 2 tables in admin panel and set predefinitions in their settings https://c2n.me/48YmMqO.png

Then create in file functions.php your own shortcode, where depending of the user logged-in or not, show one of the [woot] tables

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.