|
|
@@ -907,9 +907,24 @@ class CartTokenProcessor implements ProcessorInterface
|
|
|
\Webkul\Shipping\Facades\Shipping::collectRates();
|
|
|
}
|
|
|
|
|
|
+ $cartId = $cart->id;
|
|
|
+
|
|
|
CartFacade::collectTotals();
|
|
|
|
|
|
$cart = CartFacade::getCart();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * When cart has no items, some flows may leave facade cart as null
|
|
|
+ * after totals collection. Fallback to DB lookup by original cart id.
|
|
|
+ */
|
|
|
+ if (! $cart && $cartId) {
|
|
|
+ $cart = CartModel::find($cartId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (! $cart) {
|
|
|
+ throw new ResourceNotFoundException(__('bagistoapi::app.graphql.cart.cart-not-found'));
|
|
|
+ }
|
|
|
+
|
|
|
$cart->load('items.product');
|
|
|
|
|
|
$cartData = CartData::fromModel($cart);
|