add notice instead of throwing error
This commit is contained in:
@@ -13,7 +13,8 @@ class Wiaas_Checkout {
|
|||||||
$item_id = $item['data']->get_id();
|
$item_id = $item['data']->get_id();
|
||||||
if (wc_pb_is_bundle_container_cart_item($item) &&
|
if (wc_pb_is_bundle_container_cart_item($item) &&
|
||||||
(Wiaas_Package_Status::get_package_status($item_id) !== Wiaas_Package_Status::AVAILABLE)){
|
(Wiaas_Package_Status::get_package_status($item_id) !== Wiaas_Package_Status::AVAILABLE)){
|
||||||
throw new Exception('Package ' . $item['data']->get_title() . ' cannot be purchased at the moment');
|
wc_add_notice( 'Package ' . $item['data']->get_title() . ' cannot be purchased at the moment', 'error' );
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,6 +33,9 @@ class Wiaas_Checkout {
|
|||||||
wc_set_time_limit( 0 );
|
wc_set_time_limit( 0 );
|
||||||
|
|
||||||
do_action( 'woocommerce_before_checkout_process' );
|
do_action( 'woocommerce_before_checkout_process' );
|
||||||
|
if(wc_notice_count( 'error' ) > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$customer = wp_get_current_user();
|
$customer = wp_get_current_user();
|
||||||
|
|
||||||
$order_id = WC()->checkout()->create_order(array());
|
$order_id = WC()->checkout()->create_order(array());
|
||||||
|
|||||||
Reference in New Issue
Block a user