Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
80 stars 29 forks source link

Action buttons such as Cancel on Subscriptions page no longer work #553

Closed rlmajcom closed 1 month ago

rlmajcom commented 6 months ago

Describe the bug

Sometime in the last couple of months, hover Actions on the Subscriptions page no longer work, they return a 302 response page not found.

To Reproduce

  1. Go to /wp-admin/admin.php?page=wc-orders--shop_subscription&paged=1
  2. Click on the Cancel hover action that appears when you hover near the Active indicator in the status column
  3. The page will refresh but the Subscription cancel action does not occur
  4. In Chrome console, you can see two requests, the first is a 302 reponse, the second is a 200 response: https://www.example.com/wp-admin/admin.php?page=wc-orders--shop_subscription&paged=1&order%5B0%5D=63398&_wpnonce=xyz123&action=cancelled

https://www.example.com/wp-admin/admin.php?page=wc-orders--shop_subscription&paged=1

Note in the above, 63398 is an actual order ID, but I don't know why this is used: order%5B0%5D=63398 as I think this gets decoded as order[0]=63398
IS THAT THE CORRECT FORMAT?

Otherwise, not sure why this is causing a 302 error. Note that it works fine when I cancel from within the order, just not using the Cancel hover action.

I have HPOS enabled the last couple of months, in case this is part of what triggered the issue. All else is working fine with HPOS and I am no longer syncing orders.

Expected behavior

The order should go into Pending Cancel status when you click the Cancel hover action

Actual behavior

See 3. and 4. above

Product impact

WooCommerce Subscriptions

Additional context

martinmacke commented 2 months ago

Can confirm and replicate this behavior, bug seems to be directly related to HPOS. However, to add more details, this seems to only happen after some filtering is applied to the subscriptions list, like specific payment method or filtering a specific customer.

When using the WordPress posts storage (legacy), all hover action buttons work fine, but after switching to HPOS, they no longer work.

Screenshot 2024-05-01 at 21 25 43

mattallan commented 2 months ago

Thanks @rlmajcom for the report and also thanks @martinmacke for providing this extra detail:

However, to add more details, this seems to only happen after some filtering is applied to the subscriptions list, like specific payment method or filtering a specific customer.

I was able to replicate this and will get a fix in the next release.