Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Hide shipping costs until an address is entered" #27143

Merged
merged 3 commits into from Aug 11, 2020
Merged

Conversation

claudiosanches
Copy link
Contributor

@claudiosanches claudiosanches commented Jul 28, 2020

All Submissions:

Changes proposed in this Pull Request:

Currently by enabling woocommerce_shipping_cost_requires_address will display shipping costs if finds a country or if a state + postcode, what doesn't really reflects what the settings says.

This PR makes woocommerce_shipping_cost_requires_address a little more strict by displaying shipping costs only when a customer enters a country, state and postcode, those are all required information to proper calculate shipping zones and costs.

Closes #26876.

How to test the changes in this Pull Request:

  1. Navigate to WooCommerce/Settings/Shipping/Shipping options and select the following checkboxes:
  • Hide shipping costs until an address is entered
  • Default to customer billing address
  • Enable debug mode

Screen Shot 2020-06-25 at 5 33 24 PM

  1. From a private browser window start a guest cart by placing an item to the cart and observe that the shipping rate is being displayed regardless of the fact that Hide shipping costs until an address is entered is selected. Note that the address may get partially entered by the geolocation option or from the store location:

ship

  1. Now apply this patch and update your cart.
  2. Not that now shipping costs only get displayed if you have entered country, state and postcode, like for a recurring customer.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Fix - Fixed the logic behind "Hide shipping costs until an address is entered".

@claudiosanches claudiosanches added the priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. label Jul 28, 2020
Copy link
Contributor

@juliaamosova juliaamosova left a comment

Choose a reason for hiding this comment

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

Tested this PR and it works great!

Documenting my experience below:

  1. With Hide shipping costs until an address is entered enabled:

hide

There is no shipping calculator on the cart. The shipping charge appears on the Checkout page only when the user enters country, states, and postcode:

Screen Shot 2020-08-10 at 7 42 30 PM

  1. With both Enable the shipping calculator on the cart page and Hide shipping costs until an address is entered enabled:

both

There is a link to the shipping calculator on the Cart page as expected. When the user enters the country, state, and the postcode, the shipping charge appears:

Screen Shot 2020-08-10 at 7 44 42 PM

Noting that I also tested this with Geolocation enabled and MaxMind integration set up - everything works as expected as described in this PR.

Also unit test ❤️

Copy link
Contributor

@jonathansadowski jonathansadowski left a comment

Choose a reason for hiding this comment

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

Nice job. Looks good to me 👍. Unit tests look good, and the test plan works great.

@claudiosanches claudiosanches added this to the 4.5.0 milestone Aug 11, 2020
@claudiosanches claudiosanches merged commit 29bc988 into master Aug 11, 2020
@claudiosanches claudiosanches deleted the fix/26876 branch August 11, 2020 23:06
@woocommercebot woocommercebot added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Aug 11, 2020
@claudiosanches claudiosanches removed the release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] label Aug 11, 2020
@Lolosan
Copy link

Lolosan commented Aug 24, 2020

No need for country and state. We get country from geolocation and state is useless with postcode (most accurate)

Asking for 3x customer input, is asking for 3x sanitize, mistakes, correction workload. Let alones, customer UX

After postcode input, in frontend is better to echo "this country, this state, this postcode -> click here to change" instead of "nothing -> click here to work for me"

Will we be able to use postcode alone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. release: add changelog Mark all PRs that have not had their changelog entries added. [auto]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Hide shipping costs until an address is entered" option doesn't work
5 participants