Add required filters to allow custom order item types
This commit is contained in:
parent
adfd955194
commit
373bdda4f8
|
@ -652,13 +652,13 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
|
|||
* @return string group
|
||||
*/
|
||||
protected function type_to_group( $type ) {
|
||||
$type_to_group = array(
|
||||
$type_to_group = apply_filters( 'woocommerce_order_type_to_group', array(
|
||||
'line_item' => 'line_items',
|
||||
'tax' => 'tax_lines',
|
||||
'shipping' => 'shipping_lines',
|
||||
'fee' => 'fee_lines',
|
||||
'coupon' => 'coupon_lines',
|
||||
);
|
||||
) );
|
||||
return isset( $type_to_group[ $type ] ) ? $type_to_group[ $type ] : '';
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,12 @@ class WC_Order_Factory {
|
|||
case 'tax' :
|
||||
$classname = 'WC_Order_Item_Tax';
|
||||
break;
|
||||
default :
|
||||
$classname = apply_filters( 'woocommerce_get_order_item_classname', $classname, $item_type, $item_id );
|
||||
break;
|
||||
}
|
||||
if ( $classname ) {
|
||||
|
||||
if ( class_exists( $classname ) ) {
|
||||
try {
|
||||
// Try to get from cache, otherwise create a new object,
|
||||
$item = wp_cache_get( 'object-' . $id, 'order-items' );
|
||||
|
|
Loading…
Reference in New Issue