Well, I found the following solution:
$args = array(
'category' => array( 'category_slug' )
// or 'term_taxonomy_id' => 4 i.e. category ID
);
foreach( wc_get_products($args) as $product ){
foreach( $product->get_attributes() as $attr_name => $attr ){
echo wc_attribute_label( $attr_name ); // attr label
// or get_taxonomy( $attr_name )->labels->singular_name;
foreach( $attr->get_terms() as $term ){
echo $term->name;
}
}
}
Related Posts:
- WooCommerce: One term for Many Product Attributes
- Display single product attribute value on Shop page (Woocommerce)
- Get product details by url key in WordPress woocommerce
- Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?
- Extend Woocommerce rest api routes fails
- Display Categories Assigned to a WooCommerce Product
- woocommerce_before_calculate_totals in woocommerce 3.0
- How to get woocomerce attributes thumbnail in PHP? [closed]
- Can’t create term for product attribute
- Remove “Choose An Option” on Product Variation & Auto Select Instead
- why featured product not updated in postmeta table in woocommerce?
- Programmatically adding product attributes to WP / Woo commerce
- Woocommerce custom search
- WP_Error on attribute + term insert
- Get product variation attribute titles – WooCommerce
- How to change Attribute Type
- WooCommerce – buying as well as selling
- Is it possible to merge Woocommerce attributes? [closed]
- Best Practice – Customise a WooCommerce+WordPress Templates
- How to remove product attribute row woocommerce using code
- WooCommerce Simple Product Options List
- Woocommerce: Any way to list all products *without* a specific attribute?
- wp_set_object_terms setting only first id from array
- Restrict product tags archive to certain users
- Split taxonomies on different pages
- Exclude Specific Product Category for showing up in its parent category page
- How to add product variations for large number of products in WooCommerce?
- WooCommerce: how to set stock per attribute on variable product
- Importing Attributes in to Woocommerce
- Woocommerce: Some action hooks not firing inside class [closed]
- Is it possible Different templates of products for specific category in WooCommerce?
- Display x number of terms and exclude hidden
- WooCommerce – Adding Product Attributes to CSV Export
- WordPress and WooCommerce How to Assign Attribute Based Pricing
- Create templates from attributes for categories
- cannot create product attribute (taxonomy) and add terms on the same execution
- .php file for woocommerce edit category? [closed]
- Change Firstname & Lastname order in the order-processing e-mail templates
- Order by date on category dynamically – Woocommerce
- Woocomnerce Limit Purchase value before proceed checkout
- how to change the “return to shop” button text? [closed]
- override the default WooCommerce products search form
- Add to cart – button should be disabled
- wordpress/woocommerce login url not redirecting correctly
- Woocommerce custom checkout form
- How can I override wp_price woocommerce function in my theme
- Woocommerce custom field calculation
- Woocomerce pulling wrong time from server -5 hrs difference
- I want hide view more button if price is blank
- how to scrolling image on single product page
- WooCommerce – change child category URL structure
- How to display WooCommerce product tag names on home and category pages
- Woocommerce : read [max_qty] using backorder
- Show password while you are typing it on the “my account” login page
- Specifically Link To the “Leave a review” part of product page? [closed]
- Check if a WooCommerce Order Item has a specific meta data key
- Using the WordPress and WooCommerce REST APIs in the same Node app
- Woocommerce before and after shop loop not works
- Is there any way to pro-grammatically create product categories and assign thumbnails in PHP and WooCommerce?
- WooCommerce Admin order – Only run action if user is loaded
- Creating child theme out of Coeur
- Simple Product not displaying in frontend
- How to add a “buy now” button below “add to cart” button [closed]
- Variation Swatches for WooCommerce – too many variations
- Functions.php change for Woocommerce not working
- Add attribute taxonomy through code don’t appear in admin product page
- Cart page displays the price and amount as zero regardless of price entered [closed]
- Hiding Short Description in Shop Page, WooCommerce
- Hide sidebar and change layout Blog Page using is_page() function
- WooCommerce get_author_posts_url() – Author URL redirecting to shop base
- How to make an edit to an already published post back to Draft
- Woocommerce Advanced Shipping (WAS) condition is not being called when selecting “Ship to different address” [closed]
- Woocommerce replace product page image with product tabs [closed]
- Error message if user is buying less than 200 euros of a given product [closed]
- Remove Visual Editor and P tags from WooCommerce Taxonomy Descriptions [closed]
- WooCommerce show a variation both in check boxes and in a list
- Display data when category is empty
- Woocommerce Remove Tax by Product Type
- wordpress shortcode not working
- Migrating data from Woocommerce to another webapp
- Create alphabetical Pagination for custom taxonomy?
- WooCommerce: How to insert filtered attribute(s) in page title of archive?
- Apply a custom WooCommerce order status based on user role
- After disabling WPML multi currency, the currency is still handled by the WPML
- Woocommerce product name [closed]
- How do i wrap woocomerce attribute in list?
- How to use Custom Field to display product brief description in shop page with Woocommerce?
- How can i change what one category displays?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- How can I edit the Woocommerce product widget html class?
- Synchronise Renewals on existing subscriptions [closed]
- How To Customize The Product Page Template for a WooCommerce Custom Product Type Plugin [closed]
- Problem while adding the variable product woocommerce
- Hide Add to Cart button on woocommerce Product description page of a particular product
- WooCommerce Cart Items
- /page/ is not working with a custom permalink structure (WooCommerce)
- WooCommerce Bookings Plugin Not Saving Order ID
- Change Out of Stock Error Message in WooCommerce Cart
- Append woocommerce category to product title globally? [closed]