From a633ff8abf189898b4dbd74fe897b4a04f391c31 Mon Sep 17 00:00:00 2001 From: Thilina Pituwala Date: Mon, 2 Jan 2023 11:34:20 +0100 Subject: [PATCH] Fix signature mismatch in WC CLI command api calls (#36240) --- plugins/woocommerce/changelog/fix-wc-cli-commands | 4 ++++ plugins/woocommerce/includes/admin/helper/class-wc-helper.php | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/fix-wc-cli-commands diff --git a/plugins/woocommerce/changelog/fix-wc-cli-commands b/plugins/woocommerce/changelog/fix-wc-cli-commands new file mode 100644 index 00000000000..176fd4ad1e6 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-wc-cli-commands @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fix the signature mismatch affecting wc cli commands ability to fetch user subscription data. diff --git a/plugins/woocommerce/includes/admin/helper/class-wc-helper.php b/plugins/woocommerce/includes/admin/helper/class-wc-helper.php index de712d82f6a..b23a6c129f3 100644 --- a/plugins/woocommerce/includes/admin/helper/class-wc-helper.php +++ b/plugins/woocommerce/includes/admin/helper/class-wc-helper.php @@ -1280,6 +1280,8 @@ class WC_Helper { $source = 'inbox-notes'; elseif ( stripos( $request_uri, 'admin-ajax.php' ) ) : $source = 'heartbeat-api'; + elseif ( defined( 'WP_CLI' ) && WP_CLI ) : + $source = 'wc-cli'; endif; // Obtain the connected user info. @@ -1287,7 +1289,7 @@ class WC_Helper { 'subscriptions', array( 'authenticated' => true, - 'query_string' => esc_url( '?source=' . $source ), + 'query_string' => '' !== $source ? esc_url( '?source=' . $source ) : '', ) );