diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-checkout.php b/backend/app/plugins/wiaas/includes/class-wiaas-checkout.php index 8976880..facf552 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-checkout.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-checkout.php @@ -3,7 +3,7 @@ class Wiaas_Checkout { public static function init(){ - add_action( 'woocommerce_before_checkout_process', array(__CLASS__, 'validate_wiaas_packages')); + add_action( 'woocommerce_check_cart_items', array(__CLASS__, 'validate_wiaas_packages')); } public static function validate_wiaas_packages(){ @@ -33,13 +33,8 @@ class Wiaas_Checkout { wc_set_time_limit( 0 ); do_action( 'woocommerce_before_checkout_process' ); - if(wc_notice_count( 'error' ) > 0) { - return false; - } - $customer = wp_get_current_user(); - $order_id = WC()->checkout()->create_order(array()); - $order = wc_get_order( $order_id ); + $customer = wp_get_current_user(); // Check if cart empty before proceeding if (WC()->cart->is_empty()) {