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

      The Real Person!

      Author WeLaunch acts as a real person and verified as not a bot.
      Passed all tests against spam bots. Anti-Spam by CleanTalk.
      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 su*****@we******.io

  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

    • Daniel Barenkamp

      The Real Person!

      Author Daniel Barenkamp acts as a real person and verified as not a bot.
      Passed all tests against spam bots. Anti-Spam by CleanTalk.
      says:

      Yes correct!

    • JUNQUAS says:

      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.

      • Daniel

        The Real Person!

        Author Daniel acts as a real person and verified as not a bot.
        Passed all tests against spam bots. Anti-Spam by CleanTalk.
        says:

        That would be easier to hide via custom css

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

        • Daniel

          The Real Person!

          Author Daniel acts as a real person and verified as not a bot.
          Passed all tests against spam bots. Anti-Spam by CleanTalk.
          says:

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

    • Daniel

      The Real Person!

      Author Daniel acts as a real person and verified as not a bot.
      Passed all tests against spam bots. Anti-Spam by CleanTalk.
      says:

      Sorry but we do not offer any free version.

Leave a Reply

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