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.9.5.1

apply_filters('woocommerce_ajax_add_order_item_validation') is found 1 times:

  • /includes/class-wc-ajax.php line 1066
    					/* 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 ) );