Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Cannot return null for non-nullable field AvailableShippingMethod.method_code when no shipping methods are available #524

Closed
TomashKhamlai opened this issue Mar 22, 2019 · 1 comment
Assignees
Labels
bug Something isn't working Component: QuoteGraphQl

Comments

@TomashKhamlai
Copy link
Contributor

TomashKhamlai commented Mar 22, 2019

Preconditions (*)

  1. Create Customer with US address (default billing and default shipping address)

Steps to reproduce (*)

  1. Navigate to Stores> Settings>Configuration>Sales>Shipping Methods and turn off Flat Rate
  2. Enable Free Shipping but go to Ship to Applicable Countries and uncheck Use Default
  3. In Ship to Specific Countries set country to United Kingdom only.
  4. In Show Method if Not Applicable set Yes
  5. Get Customer Token
  6. Create empty Cart
  7. Add simple product to cart
  8. Execute query cart:
query {
  cart(
    cart_id: "mfdHyHY0QgtXW5LeHxfJ0nVCjWjy655n"
  ) {
    available_payment_methods {
      code
      title
    }
    shipping_addresses {
      available_shipping_methods {
        carrier_title
        method_code
      }
    }
    
  }
}

Expected result (*)

"available_shipping_methods": [
            {
              "carrier_code": "freeshipping",
              "carrier_title": "Free Shipping",
              "method_code": null,
              "method_title": null,
              "error_message": "This shipping method is not available. To use this shipping method, please contact us.",
              "amount": 0,
              "base_amount": null,
              "price_excl_tax": 0,
              "price_incl_tax": 0,
              "available": false
            }

Actual result (*)

  1. Internal Server Error:
{
  "errors": [
    {
      "debugMessage": "Cannot return null for non-nullable field AvailableShippingMethod.method_code.",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 10,
          "column": 9
        }
      ],
      "path": [
        "cart",
        "shipping_addresses",
        0,
        "available_shipping_methods",
        0,
        "method_code"
      ]
    }
  ],
  "data": {
    "cart": {
      "available_payment_methods": [
        {
          "code": "checkmo",
          "title": "Check / Money order"
        }
      ],
      "shipping_addresses": [
        {
          "available_shipping_methods": [
            null
          ]
        }
      ]
    }
  }
}
@naydav
Copy link
Contributor

naydav commented Apr 29, 2019

#526

@naydav naydav closed this as completed Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Component: QuoteGraphQl
Projects
None yet
Development

No branches or pull requests

3 participants