How to add custom Data to the WooCommerce Products PDF?

If you want to add / show some custom data like post meta or similar, you can use one of our hooks. An example:

 add_filter( 'woocommerce_pdf_catalog_before_product_information_categories', 'show_case_pack_in_pdf', 10, 2);
 function show_case_pack_in_pdf ($html, $id) {
 	
 	$product = wc_get_product($id);
 	$pid= $product->get_id();

 	$case_pack = get_post_meta($pid,'case_pack',true); 

	$html = 'Case Pack: ' . $case_pack;

	return $html;
 }

13 thoughts on “How to add custom Data to the WooCommerce Products PDF?

  1. Jenny says:

    Hi there, I have just purchased this product and am loving it. I just want to know how to change the button text from “Category Catalogue” to just “Catalogue”. I also want to be able to add one attribute (which is author) so I can tell who made which paintings. Can you help?
    thanks so much, Jenny

    • WeLaunch says:

      Hi Jenny, you can change the text with loco translate for example. Adding a custom field called author requires you to use our hooks inside the plugin. We can customize / add this feature for you, contact our customization service at [email protected]

  2. Tahir says:

    Hi,
    This is a very nice feature.

    “Show Product Attributes” shows all when enabled.
    Can only “Attributes> Battery Capacity” be displayed with this code?

    best regards,
    Tahir

    • NaturalWeb says:

      Hi Geoff,
      In my case is this : wholesale_customer_wholesale_price but depend on what plugin do you use.

      But i can’t show the wholesale price for the variations, the table is compose with some fields like title, price, sku and comment but don’t have any option to add the custom fields.

      Daniel, exist any filter to add custom fields of variations to the table ??

Leave a Reply

Your email address will not be published. Required fields are marked *