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?
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?
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