diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php index d0bded279bee5..a9e0ba59d15d9 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php +++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php @@ -10,7 +10,6 @@ use Magento\Framework\Api\ExtensibleDataObjectConverter; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\GraphQl\Config\Element\Field; -use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Quote\Api\Data\ShippingMethodInterface; @@ -66,19 +65,13 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value $shippingRates = $address->getGroupedAllShippingRates(); foreach ($shippingRates as $carrierRates) { foreach ($carrierRates as $rate) { - $method = $this->dataObjectConverter->toFlatArray( + $methods[] = $this->dataObjectConverter->toFlatArray( $this->shippingMethodConverter->modelToDataObject($rate, $cart->getQuoteCurrencyCode()), [], ShippingMethodInterface::class ); - if ($method['available'] && $method['error_message'] === "") { - $methods[] = $method; - } } } - if (count($methods) === 0) { - throw new GraphQlNoSuchEntityException(__(' This shipping method is not available. To use this shipping method, please contact us.')); - } return $methods; } } diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls index a9784e97c8952..f6d3d0fe46149 100644 --- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls +++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls @@ -231,13 +231,14 @@ type SelectedShippingMethod { type AvailableShippingMethod { carrier_code: String! carrier_title: String! - method_code: String! - method_title: String! + method_code: String @doc(description: "Could be null if method is not available") + method_title: String @doc(description: "Could be null if method is not available") error_message: String amount: Float! - base_amount: Float! + base_amount: Float @doc(description: "Could be null if method is not available") price_excl_tax: Float! price_incl_tax: Float! + available: Boolean! } type AvailablePaymentMethod {