-2

I'm using WooCommerce - Adding product category to order-details table answer code (via the woocommerce_order_item_name filter hook).

It shows how to display category of a product on the email invoice. How can I display all the product attributes?

7uc1f3r
  • 28,449
  • 17
  • 32
  • 50

1 Answers1

1

You can create Product object from its ID and then use woocommerce get_attribute method.

$_product = new WC_Product($item['product_id']);
$product_attr = $_product->get_attributes();

This would return you an array of all attributes assigned to that product, you can just loop through them and display it.

https://woocommerce.github.io/code-reference/classes/WC-Product.html#method_get_attributes

Swapnil Ghone
  • 708
  • 9
  • 17