prevent checkout with invalid package
This commit is contained in:
@@ -16,6 +16,20 @@ 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' );
|
||||||
|
$customer = wp_get_current_user();
|
||||||
|
|
||||||
|
//check if any package became invalid
|
||||||
|
$items = WC()->cart->get_cart();
|
||||||
|
foreach($items as $item) {
|
||||||
|
$item_id = $item['data']->get_id();
|
||||||
|
if (wc_pb_is_bundle_container_cart_item($item) &&
|
||||||
|
(Wiaas_Package_Status::get_package_status($item_id) !== Wiaas_Package_Status::AVAILABLE)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$order_id = WC()->checkout()->create_order(array());
|
||||||
|
$order = wc_get_order( $order_id );
|
||||||
|
|
||||||
// Check if cart empty before proceeding
|
// Check if cart empty before proceeding
|
||||||
if (WC()->cart->is_empty()) {
|
if (WC()->cart->is_empty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user