Skip to content

[Backport to release/11.2] Revert apostrophe encoding in classic checkout requests - #69649

Merged
mcliwanow merged 1 commit into
release/11.2from
cherry-pick-PR69644-to-release/11.2
Oct 9, 2026
Merged

mcliwanow merged 1 commit into
release/11.2from
cherry-pick-PR69644-to-release/11.2

Conversation

@woocommercebot

Copy link
Copy Markdown
Collaborator

This PR is a cherry-pick of #69644 to release/11.2.

Original PR Description

Why

#68365 changed the classic checkout to send update_order_review and coupon requests as a pre-serialized string (encodeApostrophes( $.param( data ) )) instead of a data object. That has two side effects in 11.2.0.

  1. $.param() turns fields removed via woocommerce_checkout_fields / woocommerce_billing_fields into empty values (country=&state=), where $.ajax() used to drop them, so the session customer's country, state and postcode get blanked. With billing_country removed and "Force shipping to the customer billing address" (or woocommerce_cart_needs_shipping_address false), place order fails with "Please enter an address to continue." for guests and logged-in customers. With postcode/state removed and "Hide shipping costs until an address is entered", shipping options disappear for logged-in customers. Reports: https://wordpress.org/support/topic/problems-with-checkout-after-last-update-to-11-2-0/ and https://wordpress.org/support/topic/shipping-method-disappears-in-classic-checkout-after-woocommerce-11-2-0/ (the first reporter's snippet follows our own checkout fields tutorial).
  2. Third-party jQuery.ajaxPrefilter callbacks that read originalOptions.data as an object now get a string (e.g. HurryTimer's coupon expiry check, Global Seller Services).

Reverting restores the 11.1 behaviour. I reproduced it locally on 11.2.0: with only #68365's checkout.js hunks reversed, the blocked orders go through for guests and logged-in customers. The apostrophe/WAF fix from #68365 will be re-landed separately (passing the object to $.ajax and encoding in beforeSend), with tests for removed fields and prefilters.

What changed

Testing

  1. On 11.2.0 add to a theme or mu-plugin: add_filter( 'woocommerce_billing_fields', function ( $f ) { unset( $f['billing_country'], $f['billing_state'] ); return $f; } ); and set WooCommerce > Settings > Shipping > Shipping destination to "Force shipping to the customer billing address".
  2. Open the classic checkout ([woocommerce_checkout] page) with a physical product in the cart, fill the visible fields and place the order. It fails with "Please enter an address to continue."
  3. With this branch, the order is placed.
  4. In devtools, the update_order_review request no longer contains country= or state=.

Automated: pnpm test:js -- frontend/test/checkout in plugins/woocommerce/client/legacy passes (21 tests on trunk, 20 on a local cherry-pick to release/11.2, which applies without conflicts). eslint on checkout.js and the test file reports no errors.

🤖 Generated with Claude Code

This reverts commit 975cd3b (#68365).

It restores the 11.1 request shape. update_order_review, apply_coupon
and remove_coupon pass a data object to $.ajax() again, so fields
removed with checkout field filters are dropped instead of being sent
as empty values that blank the customer's country, state and postcode.
Third-party ajaxPrefilter callbacks get the data object again rather
than a pre-serialized string. Place order sends $form.serialize() as
before.

The #68365 tests are replaced with tests for the restored request
shape. The apostrophe encoding will be re-landed separately.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the 11.2.0 milestone Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Testing Guidelines

Hi @mcliwanow ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@github-actions github-actions Bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a commit that changes plugin code.

@mcliwanow
mcliwanow merged commit 1c970c2 into release/11.2 Oct 9, 2026
30 of 31 checks passed
@mcliwanow
mcliwanow deleted the cherry-pick-PR69644-to-release/11.2 branch October 9, 2026 12:17
@github-actions github-actions Bot added the metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Size Change: 0 B 🆕

Total Size: 0 B

compressed-size-action

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

Labels

metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo