Merge pull request #24518 from pinalj/master
Add new hook for add-order-item
This commit is contained in:
commit
df887bccc8
|
@ -898,7 +898,11 @@ class WC_AJAX {
|
|||
if ( ! $product ) {
|
||||
throw new Exception( __( 'Invalid product ID', 'woocommerce' ) . ' ' . $product_id );
|
||||
}
|
||||
$check = apply_filters( 'woocommerce_ajax_add_order_item_validation', $product, $order, $qty );
|
||||
|
||||
if ( is_wp_error( $check ) ) {
|
||||
throw new Exception( $check->get_error_message() );
|
||||
}
|
||||
$item_id = $order->add_product( $product, $qty );
|
||||
$item = apply_filters( 'woocommerce_ajax_order_item', $order->get_item( $item_id ), $item_id, $order, $product );
|
||||
$added_items[ $item_id ] = $item;
|
||||
|
|
Loading…
Reference in New Issue