• Resolved drbiskit

    (@richt99)


    Hi,

    I need to override the text that gets pulled from the ‘Footer: terms & conditions, policies, etc.’ field, when the transaction includes 1 specific product. Is there a hook I should use to achieve this, or, is it best to create a new template with a conditional please?

    Many thanks.

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

    (@yordansoares)

    Hi @richt99,

    You can achieve what you have described by adding this code snippet in your site:

    /**
     * Use a different footer for specific products in the order
     */
    add_filter( 'wpo_wcpdf_footer_settings_text', function( $footer, $document ) {
    	$products_ids = array( 123, 321 ); // Enter here the product IDs separated by commas
    		if ( $order = $document->order ) {
    			foreach( $order->get_items() as $item_id => $item ) {
    				if( in_array( absint( $item['variation_id'] ), $products_ids ) || in_array( absint( $item['product_id'] ), $products_ids ) ) {
    					$footer = 'This is your alternative footer text!';
    					break;
    				}			
    			}
    		}	
    	return $footer;
    }, 10, 2 );

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

    Make sure that you have set your actual product ID(s) within $products_ids.

    Let me know if it worked!

    Thread Starter drbiskit

    (@richt99)

    Hi Yordan,

    This is perfect and just what I needed.

    Many thanks for the super speedy support!

    Best,
    Rich.

    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Amend text used on Invoice field for specific product’ is closed to new replies.