Skip to content

Fix the issue with "Shipping address is not set" exception#16753

Merged
magento-engcom-team merged 6 commits intomagento:2.2-developfrom
dmytro-ch:fix/2.2-issue-16555-multi-shipping-exception
Aug 9, 2018
Merged

Fix the issue with "Shipping address is not set" exception#16753
magento-engcom-team merged 6 commits intomagento:2.2-developfrom
dmytro-ch:fix/2.2-issue-16555-multi-shipping-exception

Conversation

@dmytro-ch
Copy link
Copy Markdown
Contributor

@dmytro-ch dmytro-ch commented Jul 12, 2018

The exception is being thrown instead of redirecting the customer to New Shipping Address form.

Description

The issues appeared because of the interrupted shipment assignment process.
As result:

  1. The "Shipping address is not set" exception (Magento\Framework\Exception\StateException) is not caught and the customer is not redirected to multishipping/checkout_address/newShipping page.
  2. The incorrectly assigned record appears in quote_address table due to the interrupted process of quote saving by Magento\Framework\Exception\StateException. It causes the additional error on Shopping Cart page, after performing the steps mentioned in Manual testing scenarios. (Fixed in: 6f88af5)

Fixed Issues

  1. "Shipping address is not set" exception in Multishipping Checkout. #16555: "Shipping address is not set" exception in Multishipping Checkout.
  2. "Shipping address is not set" exception in Multishipping Checkout. #16555: "SQLSTATE[23000]: Integrity constraint violation" when trying to access Shopping Cart.

Manual testing scenarios

  1. Log In as Customer.
  2. Add Product to Cart.
  3. Proceed to Checkout.
  4. Fill Shipping Address data, click Next (do not place Order)
  5. Return to the Storefront.
  6. Go to the Shopping Cart.
  7. Click Check Out with Multiple Addresses. (Error)
  8. Go to the Shopping Cart page again. (Error)

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)

@dmytro-ch dmytro-ch requested a review from rogyar July 12, 2018 15:24
@magento-engcom-team magento-engcom-team added Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Jul 12, 2018
@magento-engcom-team
Copy link
Copy Markdown
Contributor

Hi @dmytro-ch. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me {$VERSION} instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

Copy link
Copy Markdown
Contributor

@rogyar rogyar left a comment

Choose a reason for hiding this comment

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

Hi @dmytro-ch. Thank you for your collaboration. That's great that we have a fix, but we should slightly improve it. Let me share my thoughts. The apply method has nothing to do with the redirection. It's just a service method that sets a shipping method. So, that's absolutely normal that it throws the exception when there's no shipping address set. Other 3rd party extensions or custom implementations might expect this behavior and it's logical. So, it's not good for us to change logic on such a low level of implementation.
To fix the redirection issue, we need to find a logical part that is responsible for the redirection and make changes there. I.e. catch the StateException (or bring the StateException to this point if it's being caught somewhere else) and perform the corresponding checks/actions.

@rogyar
Copy link
Copy Markdown
Contributor

rogyar commented Aug 2, 2018

@dmytro-ch are you going to proceed with this one?

@dmytro-ch
Copy link
Copy Markdown
Contributor Author

@rogyar I will update this PR till the end of the week. Thank you!

@dmytro-ch
Copy link
Copy Markdown
Contributor Author

@rogyar I've updated the PR. Could you please check the result?
Thank you!

@magento-engcom-team
Copy link
Copy Markdown
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-2704 has been created to process this Pull Request

@magento-engcom-team
Copy link
Copy Markdown
Contributor

Hi @dmytro-ch. Thank you for your contribution.
We will aim to release these changes as part of 2.2.7.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants