Skip to content
This repository has been 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 missin #405

Merged
merged 4 commits into from
Mar 1, 2019

Conversation

XxXgeoXxX
Copy link
Member

Description (*)

Issue: #400

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
        }
      }
    }
  }
}

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

… Required parameter "shipping_carrier_code" is missing
@@ -69,13 +69,13 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value

$shippingMethod = reset($shippingMethods); // This point can be extended for multishipping

if (!$shippingMethod['cart_address_id']) {
if (!array_key_exists('cart_address_id', $shippingMethod)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can replace with isset and empty
Please check, why we don't have notices during test running

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used 'isset' instead array_key_exists

… Required parameter "shipping_carrier_code" is missin magento#405
@@ -69,13 +69,13 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value

$shippingMethod = reset($shippingMethods); // This point can be extended for multishipping

if (!$shippingMethod['cart_address_id']) {
if (!isset($shippingMethod['cart_address_id'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, need to check that value is not empty

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a condition to check empty value. Merge conflict was resolved

… Required parameter "shipping_carrier_code" is missin
… Required parameter "shipping_carrier_code" is missin
@ghost
Copy link

ghost commented Mar 1, 2019

Hi @XxXgeoXxX, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

magento-engcom-team pushed a commit that referenced this pull request Mar 1, 2019
…ed instead of Required parameter "shipping_carrier_code" is missin #405
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants