WooCommerce and Square (Order-Pay)

Hey everyone ๐Ÿ‘‹ โ€“ Iโ€™m reaching out for some help with an issue Iโ€™ve been troubleshooting extensively.

Issue: The Square payment form fails to load on the order-pay endpoint (e.g., /checkout/order-pay/) in WooCommerce. The JavaScript console throws this error:
ReferenceError: WC_Square_Payment_Form_Handler is not defined

Context:

  • This occurs only on the order-pay page (manual payment link), not the standard checkout.

  • The Square scripts (wc-square.js and wc-square-payment-gateway-payment-form.js) are returning 404 errors when trying to load.

  • I verified:
    โ€ข Files exist in the correct directory
    โ€ข File permissions are correct
    โ€ข Plugin is up to date and active
    โ€ข Code in the plugin matches working installs
    โ€ข No caching or blocking by security plugins
    โ€ข Other payment methods (like PayPal) work without issue

Steps already taken:

  • Compared plugin files to ensure completeness

  • Attempted enqueue fixes via custom snippets

  • Confirmed WooCommerce and Square versions are current

  • Tested across themes and with all other plugins disabled

  • Opened a support ticket and was advised this is a possible enqueuing bug for order-pay

Ask:
Has anyone encountered and resolved this? Or does anyone know a way to ensure Squareโ€™s JS properly enqueues on order-pay links? Iโ€™d be grateful for any insights, patches, or debug suggestions.

Thanks in advance ๐Ÿ™

2,268 Views
Message 1 of 3
Report
2 REPLIES 2

OK, a follow up, after installing older releases of WooCommerce Square, and seeing no resolve, I decided to take a different route when I discovered that when my customer take the add item to cart then take the cart to checkout, everything worked as expected, so, since I pay for orders via Admin Screen and customers pay for order via email links - here is the snippet I added...

 

add_action('template_redirect', function () {
global $wp;

// Check for the WooCommerce order-pay URL structure
if (isset($wp->query_vars['order-pay']) && isset($_GET['pay_for_order']) && isset($_GET['key'])) {
$order_id = absint($wp->query_vars['order-pay']);
$order = wc_get_order($order_id);

// Proceed only if the order exists and is pending payment
if (!$order || !$order->has_status('pending')) {
return;
}

// Empty the current cart
WC()->cart->empty_cart();

// Add each product in the order back into the cart
foreach ($order->get_items() as $item) {
$product_id = $item->get_product_id();
$quantity = $item->get_quantity();

if ($product_id && $quantity > 0) {
WC()->cart->add_to_cart($product_id, $quantity);
}
}

// Redirect to the cart page with a reference to the original order
wp_safe_redirect(wc_get_cart_url() . '?from_order=' . $order_id);
exit;
}
});

2,250 Views
Message 2 of 3
Report

Just following up โ€” Iโ€™ve confirmed that my account (acct_...) is a Stripe Express account, so I do not have access to the โ€œInstalled Appsโ€ area in the Stripe dashboard.

 

As Stripe confirmed and their API documentation states, only the platform owner (WooPayments) can disconnect an Express account.

 

Iโ€™ve already cleared all local data and reinstalled WooPayments โ€” but the plugin immediately reattaches to this under-review account from your remote storage.

 

I guess the next steps are to fully disconnect or remove this account from their system so I can onboard fresh.

2,214 Views
Message 3 of 3
Report