diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-cart.php b/backend/app/plugins/wiaas/includes/class-wiaas-cart.php index c5374eb..df8c358 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-cart.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-cart.php @@ -164,21 +164,6 @@ class Wiaas_Cart { return false; } - // Validate that order contains only stuff for single country - if ( ! WC()->cart->is_empty() ) { - - $current_country = get_user_meta(get_current_user_id(), '_wiaas_cart_items_country', true); - - if ($country !== $current_country) { - - wc_add_notice('Only packages from single country can be purchased at the same time!', 'error'); - return false; - } - } else { - - update_user_meta( get_current_user_id(), '_wiaas_cart_items_country', $country); - } - // Validate that order contains only stuff from single commercial lead / reseller / shop owner if ( ! WC()->cart->is_empty() ) { @@ -186,7 +171,7 @@ class Wiaas_Cart { if (absint($shop_owner_id) !== absint($current_shop_owner_id)) { - wc_add_notice('Only packages from single catalogue can be purchased at the same time!', 'error'); + wc_add_notice('Only packages from one catalogue can be purchased at the same time!', 'error'); return false; } } else { @@ -194,6 +179,21 @@ class Wiaas_Cart { update_user_meta( get_current_user_id(), '_wiaas_cart_shop_owner_id', $shop_owner_id); } + // Validate that order contains only items for single country + if ( ! WC()->cart->is_empty() ) { + + $current_country = get_user_meta(get_current_user_id(), '_wiaas_cart_items_country', true); + + if ($country !== $current_country) { + + wc_add_notice('Only packages from one country can be purchased at the same time!', 'error'); + return false; + } + } else { + + update_user_meta( get_current_user_id(), '_wiaas_cart_items_country', $country); + } + $customer_id = wiaas_get_current_user_organization_id(); // Retrieve package price