- Gehen Sie zu plugins/woocommerce-pdf-invoice/includes/woo-pdf-invoice.class.php
- Wir müssen an 8 Stellen in der Datei woo-pdf-invoice.class.php Änderungen vornehmen.
- Suchen Sie die Funktion total und ersetzen Sie den Code durch Folgendes:
public function total() {
if(class_exists('WOOCS')) {
return (double) WOOCS::normalize_order_data($this->orderData->id, $this->orderData->order_total);
} else {
return (double) $this->orderData->order_total;
}
}
- Sie erhalten etwa Folgendes:

- Suchen Sie dann die Funktion row_total und fügen Sie dort wie im Screenshot folgenden Code ein:
if(class_exists('WOOCS')) {
$line_subtotal = WOOCS::normalize_order_data($this->orderData->id, $line_subtotal);
}
- Suchen Sie dann die Funktion item_price und ersetzen Sie den Code durch diesen wie im Screenshot:
if((((double) $price) * (int) $item['qty']) == (double) $this->row_total($item, $this->orderData)) {
if(class_exists('WOOCS')) {
return WOOCS::normalize_order_data($this->orderData->id, $price);
} else {
return $price;
}
} else {
if(class_exists('WOOCS')) {
return WOOCS::normalize_order_data($this->orderData->id, $price);
} else {
return $price;
}
}
- Suchen Sie dann die Funktion get_totals und ersetzen Sie den folgenden Code wie im Screenshot:
if(class_exists('WOOCS')) {
$totals['subtotal'] = array(
'name'=>$this->invoiceOptions['woo_pdf_title_subtotal'],
'value'=>(double) WOOCS::normalize_order_data($this->orderData->id, $subtotal),
);
} else {
$totals['subtotal'] = array(
'name'=>$this->invoiceOptions['woo_pdf_title_subtotal'],
'value'=>(double) $subtotal,
);
}
- Suchen Sie in derselben Funktion die Zeichenkette //Display taxes below total only if subtotal is displayed including taxes und fügen Sie den folgenden Code ein:
if(class_exists('WOOCS')) {
$totals['total'] = array(
'name'=>$this->invoiceOptions['woo_pdf_title_total'],
'value'=>(double) WOOCS::normalize_order_data($this->orderData->id, $this->orderData->order_total),
);
} else {
$totals['total'] = array(
'name'=>$this->invoiceOptions['woo_pdf_title_total'],
'value'=>(double) $this->orderData->order_total,
);
}
- Suchen Sie die Funktion render_left_block und ersetzen Sie den folgenden Code:
if(class_exists('WOOCS')) {
$blocks = array(
'amount_in_words'=>array(
'title'=>$this->invoiceOptions['woo_pdf_title_amount_in_words'],
'text'=>$this->get_amount_in_words((double)WOOCS::normalize_order_data($this->orderData->id, $this->orderData->order_total), $this->invoiceOptions),
),
);
} else {
$blocks = array(
'amount_in_words'=>array(
'title'=>$this->invoiceOptions['woo_pdf_title_amount_in_words'],
'text'=>$this->get_amount_in_words((double) $this->orderData->order_total, $this->invoiceOptions),
),
);
}
- Gehen Sie zur Funktion amount_in_words und ersetzen Sie den folgenden Code:
if(class_exists('WOOCS')) {
$currency = get_post_meta($this->orderData->id, '_woocs_order_currency', TRUE);
if(!$self) {
$string .= ' ';
$string .= $currency;
}
}else{
if(!$self) {
$string .= ' ';
$string .= _n('dollar', 'dollars', $number, 'woo_pdf');
}
}
Das war's!