Skip to content

Avoid loading checkout inside full-page iframe or allow proper URL navigation #3653

@jitman

Description

@jitman

The plugin currently handles the /fb-checkout route by rendering the WooCommerce checkout page inside a full-screen <iframe> rather than performing a standard redirect. This approach causes several UX, technical, and compatibility issues.

<iframe src="' . esc_url( $checkout_url ) . '"></iframe>

Steps to Reproduce

  1. Install and activate the Facebook for WooCommerce plugin, set up with Meta Commerce account
  2. Build a test checkout URL formatted as: /fb-checkout?products={...}&coupon={...}.
  3. Upon code inspection, observe that the page loads an HTML wrapper with an <iframe> pointing to the checkout URL.

Current Behavior

  • The entire checkout experience is embedded inside an <iframe>.
  • The browser’s address bar remains fixed at /fb-checkout, even as users progress through the checkout flow.
  • Navigating elsewhere or refreshing causes confusion because the URL does not reflect the current page state.

Expected Behavior

  • Users should be redirected to the normal WooCommerce checkout URL after the cart is rebuilt, not shown within an <iframe>.
  • Alternatively, if the iframe is required for specific integrations, the plugin should:
  • Allow URL updates (pushState or redirect) when navigating to checkout or order confirmation.
  • Provide a filter or setting to disable iframe wrapping.

Issues with Current Implementation

  1. Session and Cookie Problems - Some browsers restrict cookies and local storage in iframe contexts, leading to lost sessions or failed payments.
  2. Payment Gateway Incompatibility - Payment methods could fail or are blocked in iframes.
  3. Analytics and Conversion Tracking - Conversion tracking scripts may not fire correctly in iframes.
  4. Poor UX - URL never changes, confusing users and breaking bookmarks, refreshes, and the back button.
  5. Accessibility and SEO - Screen readers and accessibility tools struggle with iframe-wrapped pages.

Proposed Solutions

  1. Preferred: Replace the iframe output with a direct redirect to wc_get_checkout_url() after rebuilding the cart and applying coupons.
  2. Alternative: Introduce a filter or option to disable iframe embedding while keeping the cart-rebuilding logic intact.
  3. Minimal: Update browser history (via window.history.pushState) to reflect the actual checkout URL inside the iframe.

Environment

  • WordPress: 6.8.3
  • WooCommerce: 10.2.2
  • Facebook for WooCommerce: 3.5.9
  • Browser: Brave (Chromium) / Safari (issues reproducible on all)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions