woocommerce_ajax_add_order_item_validation

woocommerce_ajax_add_order_item_validation

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_ajax_add_order_item_validation') is found 1 times:

  • /includes/class-wc-ajax.php line 1060
    					/* translators: %s product name */
    					throw new Exception( sprintf( __( '%s is a variable product parent and cannot be added.', 'woocommerce' ), $product->get_name() ) );
    				}
    				$validation_error = new WP_Error();
    				$validation_error = apply_filters( 'woocommerce_ajax_add_order_item_validation', $validation_error, $product, $order, $qty );
    
    				if ( $validation_error->get_error_code() ) {
    					/* translators: %s: error message */
    					throw new Exception( sprintf( __( 'Error: %s', 'woocommerce' ), $validation_error->get_error_message() ) );
    				}
    				$item_id                 = $order->add_product( $product, $qty, array( 'order' => $order ) );