Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Darren Peyou

    (@dpeyou)

    Hello @dglite,

    When you say child theme, do you mean you created a custom PDF template? If yes, does the meta-data appear in the Simple template?

    Did you add the meta-data to the product after creating an order with the items instead of before? If yes, could you create a new test order after having added the meta data?

    Thread Starter dglite

    (@dglite)

    Hi: thks for your great support, here I reply the questions…

    – yes by child theme it means I created a custom template, like /simple/ or /modern/ but a new one; // and the meta data does not appear even on the simple one, I have to add it, how can I do it?;

    – the meta data was not adde to the product originally, just when I edit the order, and it allows me to add metadata to that product inside the order edition;

    How to add it to the pdf, which is the php variable?

    Thks!

    Plugin Contributor Darren Peyou

    (@dpeyou)

    @dglite

    Did you modify the plugin files directly instead of creating a new template in a child theme? Adding the new meta-data the way you did it should make it appear on the invoice immediately after adding it, even after the order has been made, in the unmodified Simple template.
    So how did you create this custom template? Did you use the method outlined here? Creating a custom PDF template

    • This reply was modified 1 year, 3 months ago by Darren Peyou. Reason: additional info
    Thread Starter dglite

    (@dglite)

    Hi: in repy to your ticket, yes I followed that, but instead of… /templates/Simple/ I created my custom one… /templates/my-template/, and I just need to add the meta_data, it should be possible on this case?

    Plugin Contributor Darren Peyou

    (@dpeyou)

    @dglite,

    Yes, this is possible and I had just tested it. :thinking
    I’m wondering why your addition isn’t displaying on the default Simple template.
    From where did you copy the files of your custom template?
    Is it possible you are mixing up the Simple template and the Simple Premium templates?
    I ask because you mentioned the Modern template, which must mean you are using the Premium Templates extension. WordPress doesn’t allow for support for paid software here in the forums, so if you copied the files of one of the premium templates in order to create your custom template, you would need to email us at support@wpovernight.com.

    Thread Starter dglite

    (@dglite)

    Hi, no it is just the default template, but which variable should I add to the code?. For example… $meta_data? print $metadata?

    Etc. pls let me know, thks… 😉

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @dglite,

    My recommendation is using our action hooks to achieve it, like this:

    /**
     * WooCommerce PDF Invoices & Packing Slips:
     * Display item meta fields after item meta (if not empty)
     */
    add_action( 'wpo_wcpdf_after_item_meta', function( $document_type, $item, $order ) {
    	if( isset( $item['item'] ) ) {
    		// Set your item meta fields here, one per line
    		$meta_names = array(
    			'Item meta 1',
    			'Item meta 2',
    			'Item meta 3',
    		);
    		foreach ( $meta_names as $meta_name ) {
    			if ( $value = $item['item']->get_meta( $meta_name ) ) {
    				echo "<div class=\"item-meta\"><small>{$meta_name}: {$value}</small></div>";
    			}
    		}
    	}
    }, 10, 3 );
    Thread Starter dglite

    (@dglite)

    Hi, thks for your great support! I will try it!!!

    😉

    Hello there,

    i’m issuing the same problem, I’m trying to add meta to all my products, (barcode and more) but when i print the invoice it only shows product name, SKU number and weight, only after the Order i can add product meta manually from editing the order for each product individually , this is not inconvenient , is there any code i can use so a field can pop up on the plugin’s settings?

    please help me out, thank you

    im trying to say i would like something like this if its possible SCREENSHOT i found this from a different similar plug in

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Add item meta data to pdf invoices’ is closed to new replies.