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

Notice: Undefined index: shipping_carrier_code is returned instead of 'Required parameter "shipping_carrier_code" is missing' #400

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

Comments

@TomashKhamlai
Copy link
Contributor

TomashKhamlai commented Feb 25, 2019

Preconditions (*)

  1. Registered Customer
  2. Virtual Product
  3. Developer mode

Steps to reproduce (*)

  1. Generate Customer token
  2. Create empty cart as Registered Customer from GraphQL Client
  3. Add virtual product to cart from GraphQL Client but use
...
    cart {
      items {
        id
...

in output
4. Get ADDRESS_ID by hovering 'Change Billing Address' or 'Change Shipping Address'

  1. Execute:
mutation {
  setShippingMethodsOnCart(
    input: {
      cart_id: "{{ CART_ID }}"
      shipping_methods: {
        cart_address_id: {{ ADDRESS_ID }}
        method_code: "flatrate"
        carrier_code: "flatrate"
      }
    }
  ) {
    cart {
      available_payment_methods {
        code
        title
      }
      shipping_addresses {
        city
        available_shipping_methods {
          carrier_title
          error_message
          method_title
          method_code
          price_excl_tax
          price_incl_tax
        }
        selected_shipping_method {
          amount
        }
      }
    }
  }
}

Expected result (*)

  1. According to code
        if (!$shippingMethod['shipping_carrier_code']) {
            throw new GraphQlInputException(__('Required parameter "shipping_carrier_code" is missing'));

message
Required parameter "shipping_carrier_code" is missing'
is expected

Actual result (*)

  1. Notice: Undefined index: shipping_carrier_code
{
  "errors": [
    {
      "debugMessage": "Notice: Undefined index: shipping_carrier_code in /var/www/html/m2-test/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingMethodsOnCart.php on line 75",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "setShippingMethodsOnCart"
      ]
    }
  ],
  "data": {
    "setShippingMethodsOnCart": null
  }
}
@naydav
Copy link
Contributor

naydav commented Mar 2, 2019

#405

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