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

Selecting selected_shipping_methods when there's none configured results in an Internal Server Error #874

@dplaton

Description

@dplaton

Preconditions (*)

  1. Magento 2.3.2
  2. PHP 7.2

Steps to reproduce (*)

  1. Create a guest cart using the createGuestCart mutation
  2. Add a shipping address to the cart
  3. Perform the following query:
query {
  cart(cart_id: "your cart id") {
    shipping_addresses {
  	available_shipping_methods {
      carrier_code
    }
      selected_shipping_method {
        carrier_code
        carrier_title
        method_code
        method_title
      }
    }
  }
}

Expected result (*)

  1. The selected shipping method is empty/null
  2. The available shipping methods object to contain the correct carrier codes configured

Actual result (*)

An error is returned:

{
  "errors": [
    {
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 7,
          "column": 7
        }
      ],
      "path": [
        "cart",
        "shipping_addresses",
        0,
        "selected_shipping_method"
      ]
    }
  ],
  "data": {
    "cart": {
      "shipping_addresses": [
        {
          "available_shipping_methods": [
            {
              "carrier_code": "flatrate"
            }
          ],
          "selected_shipping_method": null
        }
      ]
    }
  }
}

Note that this error does not occur when we only select the selected_shipping_methods (without the available_shipping_methods), so a query like

query {
  cart(cart_id: "Kuvi8t2mSaqeh8pkWBnLXXmqQnkLu0Tr") {
    shipping_addresses {
      selected_shipping_method {
        carrier_code
        carrier_title
        method_code
        method_title
      }
    }
  }
}

returns the expected result.

This issue looks a lot like #665 and according to (#665 (comment)) it should've been investigated. However, I couldn't find and PR to fix it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions