• Resolved michielvannoppen

    (@michielvannoppen)


    Is there a way to add the payment method + total price on the packing slip?

    Or better if only a certain payment method would be indicated on the packing slip.

    Cash on delivery needs to be manually entered into the shipping software, if it is not on the packing slip it gets forgotten.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! you can do this with a code snippet:

    
    add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_packing_slip_payment_method_total', 10, 2 );
    function wpo_wcpdf_packing_slip_payment_method_total ($template_type, $order) {
    	if ($template_type == 'packing-slip') { // only on the packing slip
    		$payment_method = $order->get_payment_method();
    		$show_for_methods = array( 'cod' ); // limit to Cash On Delivery
    		if (in_array($payment_method, $show_for_methods)) {
    			$payment_method_title = $order->get_payment_method_title();
    			$order_total = $order->get_formatted_order_total();
    			echo "<div>Payment method: {$payment_method_title} ({$order_total})</div>";
    		}
    	}
    }
    

    More information about available action hooks: PDF template action hooks

    And if you haven’t worked with code snippets like this before: How to use filters

    Hope that helps!
    Ewout

Viewing 1 replies (of 1 total)
  • The topic ‘Payment method on packing slip’ is closed to new replies.