• Resolved towaa

    (@towaa)


    Hi,

    I’ve try to change subtotal by Sous-total HT but… nothing
    Can you help me to understand where i’ve made an error please ?

    Thank you

    my code :

    add_filter( ‘wpo_wcpdf_order_subtotal’, ‘wpo_wcpdf_order_subtotal_HT’, 10, 1 );
    function wpo_wcpdf_order_subtotal_HT ( $subtotal, $tax, $discount, $order_document ) {
    foreach($totals as $key => $total) {
    if($key == ‘order_subtotal’) {
    $totals[$key][‘label’] = ‘Sous Total HT’;
    }
    }
    return $totals;
    }

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

    (@alexmigf)

    Hello @towaa

    Please try this instead:

    add_filter( 'wpo_wcpdf_order_subtotal', function( $subtotal, $tax, $discount, $document ) {
    	$subtotal['label'] = 'Sous Total HT';
    	return $subtotal;
    }, 10, 4 );
    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @towaa

    The hook above shouldn’t work in the Simple Template, please try this instead:

    add_filter( 'wpo_wcpdf_woocommerce_totals', function( $totals, $order, $document_type ) {
    	if( !empty($order) ) {
    		$totals['cart_subtotal']['label'] = 'Sous Total HT';
    	}
    	return $totals;
    }, 10, 3 );
    Thread Starter towaa

    (@towaa)

    Wow ! thank you very much alex. it’s work

    have a nice day

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change subtotal’ is closed to new replies.