items_type_key filter and woocommerce_order_line_item_object fix
This commit is contained in:
parent
f71a498892
commit
fdb28218ea
|
@ -798,8 +798,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
* @return string
|
||||
*/
|
||||
protected function get_items_key( $item ) {
|
||||
|
||||
if ( is_a( $item, 'WC_Order_Item_Fee' ) ) {
|
||||
if ( is_a( $item, 'WC_Order_Item_Product' ) ) {
|
||||
return 'line_items';
|
||||
} elseif ( is_a( $item, 'WC_Order_Item_Fee' ) ) {
|
||||
return 'fee_lines';
|
||||
} elseif ( is_a( $item, 'WC_Order_Item_Shipping' ) ) {
|
||||
return 'shipping_lines';
|
||||
|
@ -808,7 +809,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
} elseif ( is_a( $item, 'WC_Order_Item_Coupon' ) ) {
|
||||
return 'coupon_lines';
|
||||
} else {
|
||||
return 'line_items';
|
||||
return apply_filters( 'woocommerce_items_type_key', '', $item );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ class WC_Checkout {
|
|||
public function create_order_line_items( &$order, $cart ) {
|
||||
foreach ( $cart->get_cart() as $cart_item_key => $values ) {
|
||||
$product = $values['data'];
|
||||
$item = apply_filters( 'woocommerce_order_line_item', new WC_Order_Item_Product(), $product);
|
||||
$item = apply_filters( 'woocommerce_order_line_item_object', new WC_Order_Item_Product(), $values );
|
||||
$item->legacy_values = $values; // @deprecated For legacy actions.
|
||||
$item->legacy_cart_item_key = $cart_item_key; // @deprecated For legacy actions.
|
||||
$item->set_props( array(
|
||||
|
|
Loading…
Reference in New Issue