Renamed filters and actions

This commit is contained in:
Mike Jolley 2017-05-23 19:16:30 +01:00
parent fdb28218ea
commit 109e951de3
3 changed files with 8 additions and 7 deletions

View File

@ -808,9 +808,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
return 'tax_lines';
} elseif ( is_a( $item, 'WC_Order_Item_Coupon' ) ) {
return 'coupon_lines';
} else {
return apply_filters( 'woocommerce_items_type_key', '', $item );
}
return apply_filters( 'woocommerce_get_items_key', '', $item );
}
/**

View File

@ -348,8 +348,12 @@ class WC_Checkout {
*/
public function create_order_line_items( &$order, $cart ) {
foreach ( $cart->get_cart() as $cart_item_key => $values ) {
/**
* Filter hook to get inital item object.
* @since 3.1.0
*/
$item = apply_filters( 'woocommerce_checkout_create_order_line_item_object', new WC_Order_Item_Product(), $cart_item_key, $values, $order );
$product = $values['data'];
$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(

View File

@ -79,7 +79,6 @@ class WC_Order_Factory {
case 'line_item' :
case 'product' :
$classname = 'WC_Order_Item_Product';
$classname = apply_filters( 'woocommerce_get_order_item_classname', $classname, $item_type, $id );
break;
case 'coupon' :
$classname = 'WC_Order_Item_Coupon';
@ -93,11 +92,10 @@ class WC_Order_Factory {
case 'tax' :
$classname = 'WC_Order_Item_Tax';
break;
default :
$classname = apply_filters( 'woocommerce_get_order_item_classname', $classname, $item_type, $id );
break;
}
$classname = apply_filters( 'woocommerce_get_order_item_classname', $classname, $item_type, $id );
if ( $classname && class_exists( $classname ) ) {
try {
return new $classname( $id );