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: set correct shipping_method indexes in cart #48383

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from

Conversation

adtennant
Copy link

@adtennant adtennant commented Jun 11, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

The $index variable is never set within templates/cart/cart-shipping.php is never set and so all of the shipping methods have name=shipping_method[0] and woocommerce_after_shipping_rate always receives 0 for the index.
Screenshot 2024-06-11 at 14 48 59

This change sets $index correctly within the loop:
Screenshot 2024-06-11 at 14 51 02

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Go to WooCommerce > Settings > Shippings and configure a Shipping Zone with multiple shipping methods available.
  2. Add at least one product to your basket.
  3. Go to the Basket or Checkout page and fill in the billing address details until the shipping methods populate.
  4. The shipping method input elements should have sequential name attributes of the form shipping_method[i] where i is their position in the list. You can use your browser's dev tools to verify this.

Changelog entry

Will update manually.

@github-actions github-actions bot added plugin: woocommerce Issues related to the WooCommerce Core plugin. type: community contribution labels Jun 11, 2024
@woocommercebot woocommercebot requested review from a team and barryhughes and removed request for a team June 11, 2024 14:07
Copy link
Contributor

Hi ,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Member

@barryhughes barryhughes left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good. For clarity, it may be worth noting that this change applies to the 'classic checkout' and not the default Blocks-driven checkout experience.

plugins/woocommerce/templates/cart/cart-shipping.php Outdated Show resolved Hide resolved
Copy link
Member

@barryhughes barryhughes left a comment

Choose a reason for hiding this comment

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

We'll also need to change the @version tag in the template. Given where we are in the release cycle, 9.1.0 makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin. type: community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants