Filter for line items in abstract-wc-order.php (#17759)

* Filter for line items in abstract-wc-order.php

When creating custom product class there are places where line items is only value that can be handled. This is one of that places causing subtotal values after checkout not to be calculated and displayed.

* Extension to woocommerce_order_get_items filter

This is extension to filter as get_items() is used for different classes and types. This way it would be possible to distinct which type is called for items.

* Removed filtering inside subtotal function

$types parameter is added as parameter for filter inside get_items() function so previous commit is reverted as there is no need for it.
This commit is contained in:
urosmil 2017-11-23 11:00:03 +01:00 committed by Mike Jolley
parent 9a95441c61
commit 18e7b25eab
1 changed files with 2 additions and 2 deletions

View File

@ -708,7 +708,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
}
return apply_filters( 'woocommerce_order_get_items', $items, $this );
return apply_filters( 'woocommerce_order_get_items', $items, $this, $types );
}
/**
@ -1599,7 +1599,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
public function get_subtotal_to_display( $compound = false, $tax_display = '' ) {
$tax_display = $tax_display ? $tax_display : get_option( 'woocommerce_tax_display_cart' );
$subtotal = 0;
if ( ! $compound ) {
foreach ( $this->get_items() as $item ) {
$subtotal += $item->get_subtotal();