WP PHP Dapatkan Nama Atribut Item Produk
$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;
}
}
}
Weary Wildebeest