I want to display all the available product attributes in woocommerce sidebar. According to the design and plugins that I am using, it's hard to use widget boxes here.So I chose to loop all the product attributes available and show them in the sidebar.
I tried the following methods that available on woocommerce docs,
- get_attribute()
- get_attributes()
- get_variation_attributes()
As well as tried some stack answers as well.
global $product;
$product->get_attributes();
But I am still getting an empty array.
My sidebar is included in woocommerce archive page. How can get the attribute name and it's values?
$WC_Product = new WC_Product($product_id);
this sounds like accessing a single product – Ramesh