I have tried this line, but it does not work for me. Can anyone help? Thanks
<?php echo esc_html( $product->get_attributes() ); ?>
The get_attributes() method returns an array, so you would have to loop through each element and then echo this out. But I think what you are actually looking for is the cart item data. This is already displayed by default with this plugin, and if it is not displayed then the cart item data might not be set correctly. Are you seeing the watts/lumens in the normal cart table?
Yes I am trying to display the data seen in the fields. However, this data does not display in the cart table directly: https://imgur.com/a/dneURvV
If I can pass the data to display in the cart itself, how will I then output onto the .PDF form?
Thank you.
That is correct, if the data is saved to cart item and you see it on the cart page, it will also show on pdf
Hi David,
Thanks for your help. I will pursue how to add this meta data to the cart which will surely resolve my issue.
For anyone interested in how to add the variations data to cart and .PDF, it worked well for me using this in functions.php
add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );
add_filter( 'woocommerce_is_attribute_in_product_name', '__return_false' );
-
This reply was modified 4 years, 11 months ago by
westham00.