Start a project

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;
 }

Questions & answers (13)

  1. AlvaroApril 18, 2023

    Please, does this work on free version?

  2. DanielApril 18, 2023

    Sorry but we do not offer any free version.

  3. GeoffJuly 21, 2021

    For example if I want to display a wholesale price, which is a meta field, in the pdf?

  4. NaturalWebOctober 22, 2021

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

  5. Mack MorenoNovember 22, 2022

    Hi, I’m looking a way to show ACF new fields to PDF Catalog. Is there any solution?

  6. DanielNovember 22, 2022

    Yes ACF Fields are well supported in our PDF Catalog plugin for WooCommerce.

  7. Geoff HayneJuly 21, 2021

    In which php file should I post similar code to add a field to the pdf?

  8. TahirJuly 31, 2020

    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

  9. Daniel BarenkampJuly 31, 2020

    Yes correct!

  10. JUNQUASApril 9, 2021

    With the same logic is it possible to hide the description of the variations of a specific product? I’m having trouble finding the names of the objects to target in the code to do this.

  11. DanielApril 9, 2021

    That would be easier to hide via custom css

  12. JennyMarch 8, 2020

    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

  13. WeLaunchMarch 8, 2020

    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]