Title: Add attributes dynamically
Last modified: May 6, 2021

---

# Add attributes dynamically

 *  Resolved [newshop](https://wordpress.org/support/users/newshop/)
 * (@newshop)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/add-attributes-dynamically/)
 * Hello,
    I would like to show the product’s attributes (“Size: M”) under the product
   name. You recommend to add this code to the custom template: `<?php if(!empty(
   $item['product'])) $this->product_attribute('Attribute name', $item['product']);?
   >` But if I get it right, I’ll first have to replace ‘Attribute name’ by the 
   attribute key like “pa_size”. But I want it to show all available attributes 
   automatically without specifying specific ones.
 * Is there a way to achieve this?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Contributor [alexmigf](https://wordpress.org/support/users/alexmigf/)
 * (@alexmigf)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/add-attributes-dynamically/#post-14412187)
 * Hi [@newshop](https://wordpress.org/support/users/newshop/)
 * You might need to use the product object function [get_attributes()](https://woocommerce.github.io/code-reference/classes/WC-Product.html#method_get_attributes),
   and after that loop through them with a `foreach`, calling the code you posted
   for each attribute name. Unfortunately this falls into the custom development
   territory and not into the free plugin support.
 * Hope that helps!
 *  Thread Starter [newshop](https://wordpress.org/support/users/newshop/)
 * (@newshop)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/add-attributes-dynamically/#post-14412335)
 * Thanks, but it seams that the solution is simply
    `<span class="item-meta"><?
   php echo $item['meta']; ?></span>`
 *  [sunnylife](https://wordpress.org/support/users/sunnylife/)
 * (@sunnylife)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/add-attributes-dynamically/#post-14415340)
 * Hi,
 * I am using this plugin to generate automated invoices. But unfortunately 2 of
   my checkout form fields i.e. “Alternate Phone No” and “Landmark” are going to
   missed in the invoice.
 * Please help me. [sabziadda.com]
 *  Plugin Contributor [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * (@yordansoares)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/add-attributes-dynamically/#post-14417555)
 * Hello [@sunnylife](https://wordpress.org/support/users/sunnylife/),
 * Could you please [create a new topic](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/#new-topic-0)
   with your question? This way we keep the forum organized and avoid annoy [@newshop](https://wordpress.org/support/users/newshop/)
   with email notifications unrelated to their query.
 * I’ll answer you there! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Add attributes dynamically’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [Yordan Soares](https://wordpress.org/support/users/yordansoares/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/add-attributes-dynamically/#post-14417555)
 * Status: resolved