Skip to content

Return URL and wc-ajax URLs duplicate the subdirectory path on sites installed in a subdirectory (7213) - #4911

Open
Dinamiko wants to merge 1 commit into
dev/developfrom
dev/PCP-7213-return-url-and-wc-ajax-ur-ls-duplicate-the-subdirectory-path-on-sites-installed-in-a-subdirectory-shop-shop-wc-ajax-ppc-return-url
Open

Dinamiko wants to merge 1 commit into
dev/developfrom
dev/PCP-7213-return-url-and-wc-ajax-ur-ls-duplicate-the-subdirectory-path-on-sites-installed-in-a-subdirectory-shop-shop-wc-ajax-ppc-return-url

Conversation

@Dinamiko

Copy link
Copy Markdown
Collaborator

On sites installed in a subdirectory (e.g. https://example.com/shop/), the return URLs sent to PayPal had the subdirectory twice: /shop/shop/?wc-ajax=ppc-return-url. Buyers coming back from 3D Secure, redirect-based payment methods, re-approval, Fastlane 3D Secure or the free-trial vault flow landed on the wrong URL. WC_AJAX::get_endpoint() already returns a path that includes the subdirectory, and wrapping it in home_url() added the subdirectory a second time.

PR Changes

The five affected call sites now use WordPress core's WP_Http::make_absolute_url( WC_AJAX::get_endpoint( … ), home_url() ). It takes only the scheme, host and port from home_url() and keeps WooCommerce's path, so the subdirectory appears once. WooCommerce's woocommerce_ajax_get_endpoint filter is still applied. Sites installed at the domain root are unaffected.

@github-actions

Copy link
Copy Markdown

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

What's included:

  • ✅ WordPress (latest)
  • ✅ WooCommerce (latest)
  • ✅ PayPal Payments plugin v4.2.2-pr4911-46441560244-g7bf0a92 (built from this PR)

Login credentials:

  • Username: admin
  • Password: password

Plugin Details:

  • Version: 4.2.2-pr4911-46441560244-g7bf0a92
  • Commit: 370db2d
  • Artifact: woocommerce-paypal-payments-4.2.2-pr4911-46441560244-g7bf0a92

💡 The demo environment resets each time you refresh. Perfect for testing!

🔄 This link updates automatically with each new commit to the PR.

⚠️ This URL is valid for 30 days from when this comment was last updated.


🤖 Auto-generated for commit 370db2d • Last updated: 2026-11-30T14:41:36.284Z

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant