chengwl 1 неделя назад
Родитель
Сommit
9d39dfcc77
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      packages/Webkul/BagistoApi/src/Services/PaymentService.php

+ 8 - 5
packages/Webkul/BagistoApi/src/Services/PaymentService.php

@@ -79,13 +79,16 @@ class PaymentService
         if ($express) {
             $this->validateExpressInitiation($cart, $input);
         } else {
-              if ($input->shippingMethod) {
-                if (! Cart::saveShippingMethod($input->shippingMethod)) {
-                    throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.shipping-method-save-failed'));
-                }
+            if(!$cart->shipping_method){
+                if ($input->shippingMethod) {
+                    if (! Cart::saveShippingMethod($input->shippingMethod)) {
+                        throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.shipping-method-save-failed'));
+                    }
                 }
+            }
             $this->validateStandardInitiation($cart, $input);
             Cart::collectTotals();
+            $cart = Cart::getCart();
         }
 
       
@@ -98,7 +101,7 @@ class PaymentService
             if (! Cart::savePaymentMethod(['method' => $input->paymentMethod])) {
                 throw new OperationFailedException(__('bagistoapi::app.graphql.checkout.payment-method-save-failed'));
             }
-            Cart::collectTotals();
+            // Cart::collectTotals();
             $cart = Cart::getCart();
         }