Skip to content

graphql mutation setShippingMethodsOnCart get wrong data in available_shipping_methods. #26742

Closed
@michaeldyl520

Description

@michaeldyl520

Preconditions (*)

1.magento 2.4-develop
2.php7.2
3.mariadb 10.1.37

Steps to reproduce (*)

See my screenshot. The same shopping cart has different shipping methods through web pages and graphql.
深度截图_选择区域_20200207110227

Expected result (*)

available_shipping_methods should contain three shipping methods

Actual result (*)

available_shipping_methods and selected_shipping_method get the same shipping method

Additional info from engcom

If there is a cart with added product in it and the Shipping Address is set
The following query

  setShippingMethodsOnCart(
    input: {
      cart_id: "7gTbC717fEjlvQmKIgPgWQaOJ1xOzziD",
      shipping_methods: [
        {
        	carrier_code: "tablerate"
          method_code: "bestway"
        }
      ]
    }
  ) {
    cart {
      shipping_addresses {
        available_shipping_methods{
          amount{
            currency
          }
          available
          carrier_code
          carrier_title
          method_code
          method_title
        }
        selected_shipping_method {
          carrier_code
          carrier_title
          method_code
          method_title
          amount {
            currency
          }
        }
      }
    }
  }
}

will return

 "data": {
    "setShippingMethodsOnCart": {
      "cart": {
        "shipping_addresses": [
          {
            "available_shipping_methods": [
              {
                "amount": {
                  "currency": "USD"
                },
                "available": true,
                "carrier_code": "tablerate",
                "carrier_title": "Best Way",
                "method_code": "bestway",
                "method_title": "Table Rate"
              }
            ],
            "selected_shipping_method": {
              "carrier_code": "tablerate",
              "carrier_title": "Best Way",
              "method_code": "bestway",
              "method_title": "Table Rate",
              "amount": {
                "currency": "USD"
              }
            }
          }
        ]
      }
    }
  }
}

The same in available_shipping_methods and in selected_shipping_method

But the cart query

query {
  cart(
    cart_id: "7gTbC717fEjlvQmKIgPgWQaOJ1xOzziD"
  ) {
    shipping_addresses {
      available_shipping_methods {
        available
        amount {
          currency
        }
        carrier_code
        carrier_title
        method_code
        method_title
      }
    }

    items {
      product {
        name
      }
    }
  }
}

Returns all three available Shipping methods

{
  "data": {
    "cart": {
      "shipping_addresses": [
        {
          "available_shipping_methods": [
            {
              "available": true,
              "amount": {
                "currency": "USD"
              },
              "carrier_code": "freeshipping",
              "carrier_title": "Free Shipping",
              "method_code": "freeshipping",
              "method_title": "Free"
            },
            {
              "available": true,
              "amount": {
                "currency": "USD"
              },
              "carrier_code": "flatrate",
              "carrier_title": "Flat Rate",
              "method_code": "flatrate",
              "method_title": "Fixed"
            },
            {
              "available": true,
              "amount": {
                "currency": "USD"
              },
              "carrier_code": "tablerate",
              "carrier_title": "Best Way",
              "method_code": "bestway",
              "method_title": "Table Rate"
            }
          ]

Metadata

Metadata

Labels

Component: GraphQLGraphQLFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions