• Resolved giftsociety

    (@giftsociety)


    Hi there! We’ve recently had ‘Added Date’ start showing on our Invoices & Packing Slips – I’m not sure what the cause is, but as we do personalised items it’s becoming quite confusing for our customers. Would you know how we can remove this element?
    Thanks so much ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @giftsociety,

    Could you please send me a screenshot of a sample invoice/packing slip to see the place where this is displayed?

    Thread Starter giftsociety

    (@giftsociety)

    Hi @yordansoares , thanks for the reply! Hope this link for a screenshot works:

    https://paste.pics/e143700727c403ec1179131cc34147a0

    • This reply was modified 3 years, 1 month ago by giftsociety.
    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for the screenshot.

    This seems to be added via item metadata. Could you please send me also the HTML output source to see if we can handle this through a code snippet? To do it, just add &output=html at the end of your invoice/packing slip URL, then Right-click > Save as…, and save it as HTML. You can use https://filebin.net/ to upload the file and share the bin URL here.

    Thread Starter giftsociety

    (@giftsociety)

    Thanks for those instructions! Here is the bin URL:

    https://filebin.net/n3quxx0k9cv3nhtj

    Plugin Contributor Yordan Soares

    (@yordansoares)

    I already saw the code, but there is not any class that we can use to apply a CSS rule to hide it. However, this code snippet should do the trick:

    /**
     * Unset specific item meta data
     */
    add_action( 'wpo_wcpdf_before_html', function ( $document_type, $document ) {
    	add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'wpo_remove_specific_item_meta_from_pdf_documents', 999, 2);
    }, 10, 2 );
    add_action( 'wpo_wcpdf_after_html', function ( $document_type, $document ) {
    	remove_filter( 'woocommerce_order_item_get_formatted_meta_data', 'wpo_remove_specific_item_meta_from_pdf_documents', 999, 2);
    }, 10, 2 );
    function wpo_remove_specific_item_meta_from_pdf_documents( $formatted_meta, $item ){
    	foreach( $formatted_meta as $key => $meta ){
    		if( in_array( $meta->key, array( 'Added date' ) ) ) {
    			unset( $formatted_meta[$key] );
    		}
    	}
    	return $formatted_meta;
    }

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Let me know if it worked!

    Thread Starter giftsociety

    (@giftsociety)

    Hi again! We have a PHP Inserter plugin, however the above code caused a critical error – is it possible to check over to see that it’s correct? Thanks!

    Thread Starter giftsociety

    (@giftsociety)

    Very sorry, it was a copy and paste error! All good and all working, thank you so so much for your help! ??

    Plugin Contributor Yordan Soares

    (@yordansoares)

    I’m glad to hear that it worked!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

    Thread Starter giftsociety

    (@giftsociety)

    Hi Yordan,

    Hoping you might be able to assist with some further information showing on our packing slips that we don’t want to be there ?? Here is the bin URL:

    https://filebin.net/abi7cyc4vg5eiyw7

    The ‘Add Ons / Accessories’ line with the images showing and title showing isn’t necessary. Is there a way we can remove this with more code snippets?

    Thanks so much!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for sharing your packing slip code, @giftsociety.

    After seeing the code, I realized that you’re using Premium Templates. You can use the Product item column block to only pass the metadata you want to show. I can show you how to do it, but since WooCommerce doesn’t allow using these forums to provide premium support, please contact us by [email protected], so I can continue to help you.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘‘Added Date’ showing on invoice/packing slip’ is closed to new replies.