Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
85 stars 31 forks source link

Fix link to subscription or order in admin notice from failed scheduled actions #379

Closed shendy-a8c closed 1 year ago

shendy-a8c commented 1 year ago

Description

As I worked on https://github.com/Automattic/woocommerce-subscriptions-core/pull/378 I found that get_edit_post_link() will return empty string if HPOS is on with sync off because _edit_link is an empty string.

Therefore, I searched for other get_edit_post_link()'s in the codebase and there is this one left in maybe_show_admin_notice().

How to test this PR

  1. Get one valid order id and one valid subscription id and execute this code.
add_option(
    WC_Subscriptions_Admin::$option_prefix . '_failed_scheduled_actions',
    [
        [
            'type' => 'type',
            'args' => [
                'subscription_id' => 40
            ]
        ],
        [
            'type' => 'type',
            'args' => [
                'order_id' => 39
            ],
        ]
    ]
);

Change the value of subscription_id and order_id.

  1. Open an admin page after that.
  2. Make sure the link to subscription and order are correct with HPOS off and on and sync off and on.
  3. Run this code to remove the admin notice.
delete_option( WC_Subscriptions_Admin::$option_prefix . '_failed_scheduled_actions' );

Product impact