WooCommerce Code Reference

WC_Helper
in package

WC_Helper Class

The main entry-point for all things related to the Helper.

Table of Contents

NOTE_NAME  = 'wccom-api-failed'
CACHE_KEY_API_ERROR  = '_woocommerce_helper_subscriptions_api_error'
Transient holding the last failed Helper API subscriptions response, so the failure can be surfaced to the merchant instead of rendering as an empty subscription list.
CACHE_KEY_CONNECTION_DATA  = '_woocommerce_helper_connection_data'
RESPONSE_CODES_WITH_SPECIFIC_MESSAGES  = array(403, 429)
Status codes that get_message_for_response_code() has purpose-written copy for. Only these are worth re-deriving on read; for anything else the message recorded at failure time is more specific than the generic "HTTP status code %d" fallback. Keep in sync with that method.
$log  : mixed
A log object returned by wc_get_logger().
$local_woo_plugins_cache  : array<string|int, mixed>|null
Per-request cache of get_local_woo_plugins(), keyed by plugin file.
$local_woo_themes_cache  : array<string|int, mixed>|null
Per-request cache of get_local_woo_themes(), keyed by stylesheet path.
_flush_authentication_cache()  : bool
Flush auth cache.
_flush_subscriptions_cache()  : void
Flush subscriptions cache.
_sort_by_name()  : int
Sort subscriptions by the Name.
_sort_by_product_name()  : int
Sort subscriptions by the product_name.
activate_helper_subscription()  : bool
Activate helper subscription.
activate_plugin()  : bool
Activate a plugin for a product key.
activated_plugin()  : void
Runs when any plugin is activated.
add_utm_params_to_url_for_subscription_link()  : string
Add tracking parameters to buttons (Renew, Purchase, etc.) on subscriptions page
admin_enqueue_scripts()  : void
Enqueue admin scripts and styles.
admin_notices()  : void
Various Helper-related admin notices.
connect_theme()  : void
Connect theme to the WCCOM.
connect_with_password()  : void|WP_Error
Allows to connect with WCCOM using application password. used it to connect via CLI
current_screen()  : mixed
Various early-phase actions with possible redirects.
deactivate_helper_subscription()  : bool
Deactivate a product subscription.
deactivated_plugin()  : void
Runs when any plugin is deactivated.
disconnect()  : void
Handles WC Helper disconnect tasks.
fetch_helper_connection_info()  : array<string|int, mixed>|WP_Error
Get details of the current WooCommerce.com connection.
flush_connection_data_cache()  : void
Flush connection data cache.
flush_local_woo_products_cache()  : void
Drop the per-request caches of get_local_woo_plugins() and get_local_woo_themes(), so the next call rescans the installed products.
flush_product_usage_notice_rules_cache()  : void
Flush product-usage-notice-rules cache.
get_api_error()  : array{code: int, message: string, retry_after: int|null}|null
The last failed Helper API subscriptions response, if one is still current.
get_cached_connection_data()  : array<string|int, mixed>|bool
Get cached connection data
get_current_filter()  : string
Get current filter.
get_filters()  : array<string|int, mixed>
Get available subscriptions filters.
get_filters_counts()  : array<string|int, mixed>
Get counts data for the filters array.
get_install_base_url()  : string
Get base URL for plugin auto installer.
get_installed_subscriptions()  : array<string|int, mixed>
Get the user's connected subscriptions that are installed on the current site.
get_local_plugins()  : array<string|int, mixed>
Get locally installed plugins
get_local_themes()  : array<string|int, mixed>
Get locally installed themes.
get_local_woo_plugins()  : array<string|int, mixed>
Obtain a list of data about locally installed Woo extensions.
get_local_woo_themes()  : array<string|int, mixed>
Get locally installed Woo themes.
get_notices()  : array<string|int, mixed>
Retrieve notice for connected store.
get_plugin_auto_update_data()  : array{auto_update: bool, auto_update_manageable: bool}
Auto-update state of an installed plugin, following the same rules as WordPress core's Plugins screen so the two screens never describe the same plugin differently.
get_product_subscription_state()  : array<string|int, mixed>
Get subscription state of a given product ID.
get_product_usage_notice_rules()  : array<string|int, mixed>
Get rules for displaying notice regarding marketplace product usage.
get_subscription()  : array<string|int, mixed>|bool
Get subscription data for a given product key.
get_subscription_install_url()  : string
Get a subscriptions install URL.
get_subscription_list_data()  : array<string|int, mixed>
Get the connected user's subscription list data. Here, we merge connected subscriptions with locally installed Woo plugins and themes. We also add in information about available updates.
get_subscription_local_data()  : array<string|int, mixed>
Add local data to a subscription.
get_subscriptions()  : array<string|int, mixed>
Get the connected user's subscriptions.
get_theme_auto_update_data()  : array{auto_update: bool, auto_update_manageable: bool}
Auto-update state of an installed theme, following the same rules as WordPress core's Themes screen.
get_unconnected_subscriptions()  : array<string|int, mixed>
Get the user's unconnected subscriptions.
get_view_filename()  : string
Get an absolute path to the requested helper view.
get_woocommerce_com_base_url()  : string
Get WooCommerce.com base URL.
has_product_subscription()  : bool
Checks whether current site has product subscription of a given ID.
is_site_connected()  : bool
Checks if `access_token` exists in `auth` option.
is_subscription_available()  : bool
Check if a subscription is available to use.
is_subscription_installed()  : bool
Check if product relating to a subscription is installed.
load()  : void
Loads the helper class, runs on init.
log()  : void
Log a helper event.
refresh_helper_subscriptions()  : void
Flush helper authentication cache.
render_helper_output()  : void
Render the helper section content based on context.
set_subscription_auto_update()  : void
Turn auto-updates on or off for the plugin or theme backing a subscription.
update_auth_option()  : void
Updates auth options and flushes cache
verify_request_hash()  : bool
Verify request hash created by WooCommerce.com.
add_api_error_notice()  : void
Adds at most one note signaling that there was an error with the WCCOM API.
get_available_subscription()  : mixed|null
Get subscriptions for a product if it is available
get_message_for_response_code()  : string
Gets a user-friendly error message based on the HTTP response code.
includes()  : void
Include supporting helper classes.
remove_api_error_notice()  : void
Remove all notes signaling an error with the WCCOM API, when the request was successful.
wccom_activate()  : array<string|int, mixed>
Activate the product subscription to WCCOM
_filter()  : void
Filter an array of subscriptions by $filter.
_flush_updates_cache()  : void
Flush updates cache.
_get_extensions_update_notice()  : string|null
Get an update notice if one or more Woo extensions has an update available.
_get_local_from_product_id()  : array<string|int, mixed>|bool
Get a local plugin/theme entry from product_id.
_get_return_notices()  : array<string|int, mixed>
Various success/error notices.
_get_subscriptions_from_product_id()  : array<string|int, mixed>|bool
Get a subscription entry from product_id. If multiple subscriptions are found with the same product id and $single is set to true, will return the first one in the list, so you can use this method to get things like extension name, version, etc.
_helper_auth_connect()  : never
Initiate a new OAuth connection.
_helper_auth_disconnect()  : never
Disconnect from WooCommerce.com, clear OAuth tokens.
_helper_auth_refresh()  : never
User hit the Refresh button, clear all caches.
_helper_auth_return()  : never
Return from WooCommerce.com OAuth flow.
_helper_plugin_deactivate()  : never
Deactivate a plugin.
_helper_subscription_activate()  : never
Active a product subscription.
_woo_core_update_available()  : bool
Whether WooCommerce has an update available.
clear_api_error()  : void
Clear the recorded Helper API subscriptions failure.
filter_valid_subscriptions()  : array<string|int, mixed>
Filter malformed entries from subscription data.
get_all_plugin_keys()  : array<string|int, string>
Keys of every installed plugin, as auto_update_plugins stores them.
get_all_theme_keys()  : array<string|int, string>
Stylesheets of every installed theme, as auto_update_themes stores them.
get_auto_update_data()  : array{auto_update: bool, auto_update_manageable: bool}
Shared auto-update state for a plugin or a theme.
get_auto_update_filter_payload()  : object
Payload for the auto_update_plugin / auto_update_theme filters, matching what core's list tables pass so third-party callbacks see the same shape on both screens.
get_helper_redirect_url()  : string
Get helper redirect URL.
get_source_page()  : string
Get the source page for the connect URL (wc-admin or wc-addons/extensions)
get_subscriptions_url()  : string
Get the URL of the My Subscriptions screen used in admin notices.
has_woo_header()  : bool
Whether an installed plugin or theme carries a Woo header, so the updater handles it.
helper_subscription_deactivate()  : never
Deactivate a product subscription.
maybe_redirect_to_new_marketplace_installer()  : void
Maybe redirect to the new Marketplace installer.
record_api_error()  : void
Record the last failed Helper API subscriptions response.

Constants

CACHE_KEY_API_ERROR

Transient holding the last failed Helper API subscriptions response, so the failure can be surfaced to the merchant instead of rendering as an empty subscription list.

private mixed CACHE_KEY_API_ERROR = '_woocommerce_helper_subscriptions_api_error'

RESPONSE_CODES_WITH_SPECIFIC_MESSAGES

Status codes that get_message_for_response_code() has purpose-written copy for. Only these are worth re-deriving on read; for anything else the message recorded at failure time is more specific than the generic "HTTP status code %d" fallback. Keep in sync with that method.

private mixed RESPONSE_CODES_WITH_SPECIFIC_MESSAGES = array(403, 429)

Properties

$local_woo_plugins_cache

Per-request cache of get_local_woo_plugins(), keyed by plugin file.

private static array<string|int, mixed>|null $local_woo_plugins_cache = ull

$local_woo_themes_cache

Per-request cache of get_local_woo_themes(), keyed by stylesheet path.

private static array<string|int, mixed>|null $local_woo_themes_cache = ull

Methods

_sort_by_name()

Sort subscriptions by the Name.

public static _sort_by_name(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

Product array.

$b : array<string|int, mixed>

Product array.

Return values
int —

_sort_by_product_name()

Sort subscriptions by the product_name.

public static _sort_by_product_name(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

Subscription array.

$b : array<string|int, mixed>

Subscription array.

Return values
int —

activate_helper_subscription()

Activate helper subscription.

public static activate_helper_subscription(string $product_key) : bool
Parameters
$product_key : string

Subscription product key.

Tags
throws
Exception

If the subscription could not be activated or found.

throws
WC_Data_Exception

If the activation fails with error details.

Return values
bool — True if activated, false otherwise.

activate_plugin()

Activate a plugin for a product key.

public static activate_plugin(string $product_key) : bool
Parameters
$product_key : string

Subscription product key.

Tags
throws
Exception

When the subscription is not found.

Return values
bool — True if activated, false otherwise.

activated_plugin()

Runs when any plugin is activated.

public static activated_plugin(string $filename) : void

Depending on the activated plugin attempts to look through available subscriptions and auto-activate one if possible, so the user does not need to visit the Helper UI at all after installing a new extension.

Parameters
$filename : string

The filename of the activated plugin.

Return values
void —

Add tracking parameters to buttons (Renew, Purchase, etc.) on subscriptions page

public static add_utm_params_to_url_for_subscription_link(string $url, string $utm_content) : string
Parameters
$url : string

URL to product page or to https://woocommerce.com/my-account/my-subscriptions/.

$utm_content : string

value of utm_content query parameter used for tracking

Return values
string — URL including utm parameters for tracking

connect_theme()

Connect theme to the WCCOM.

public static connect_theme(string $product_id) : void

Depending on the activated theme attempts to look through available subscriptions and auto-activate one if possible, so the user does not need to visit the Helper UI at all after installing a new extension.

Parameters
$product_id : string

The product id of the activated theme.

Return values
void —

connect_with_password()

Allows to connect with WCCOM using application password. used it to connect via CLI

public static connect_with_password(string $password) : void|WP_Error
Parameters
$password : string

The application password.

Return values
void|WP_Error —

current_screen()

Various early-phase actions with possible redirects.

public static current_screen(object $screen) : mixed
Parameters
$screen : object

WP screen object.

Return values
mixed —

deactivate_helper_subscription()

Deactivate a product subscription.

public static deactivate_helper_subscription(string $product_key) : bool
Parameters
$product_key : string

Subscription product key.

Tags
throws
Exception

If the subscription could not be deactivated or found.

Return values
bool — True if deactivated, false otherwise.

deactivated_plugin()

Runs when any plugin is deactivated.

public static deactivated_plugin(string $filename) : void

When a user deactivates a plugin, attempt to deactivate any subscriptions associated with the extension.

Parameters
$filename : string

The filename of the deactivated plugin.

Return values
void —

fetch_helper_connection_info()

Get details of the current WooCommerce.com connection.

public static fetch_helper_connection_info() : array<string|int, mixed>|WP_Error
Return values
array<string|int, mixed>|WP_Error —

flush_local_woo_products_cache()

Drop the per-request caches of get_local_woo_plugins() and get_local_woo_themes(), so the next call rescans the installed products.

public static flush_local_woo_products_cache() : void
Tags
since
11.2.0
Return values
void —

flush_product_usage_notice_rules_cache()

Flush product-usage-notice-rules cache.

public static flush_product_usage_notice_rules_cache() : void
Return values
void —

get_api_error()

The last failed Helper API subscriptions response, if one is still current.

public static get_api_error() : array{code: int, message: string, retry_after: int|null}|null
Tags
since
11.2.0
Return values
array{code: int, message: string, retry_after: int|null}|null — Null when the last fetch succeeded.

get_cached_connection_data()

Get cached connection data

public static get_cached_connection_data() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool — cached connection data or false connection data is not cached.

get_filters()

Get available subscriptions filters.

public static get_filters() : array<string|int, mixed>
Return values
array<string|int, mixed> — An array of filter keys and labels.

get_filters_counts()

Get counts data for the filters array.

public static get_filters_counts([array<string|int, mixed> $subscriptions = null ]) : array<string|int, mixed>
Parameters
$subscriptions : array<string|int, mixed> = null

The array of all available subscriptions.

Return values
array<string|int, mixed> — Filter counts (filter => count).

get_installed_subscriptions()

Get the user's connected subscriptions that are installed on the current site.

public static get_installed_subscriptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —

get_local_woo_plugins()

Obtain a list of data about locally installed Woo extensions.

public static get_local_woo_plugins([bool $use_cache = true ]) : array<string|int, mixed>

Scanning every installed plugin is expensive, so the result is cached for the rest of the request. Pass false after installing or removing a plugin to rescan and refresh the cache.

Parameters
$use_cache : bool = true

Whether to return the cached list when one exists.

Tags
since
11.2.0

Added the $use_cache parameter.

Return values
array<string|int, mixed> —

get_local_woo_themes()

Get locally installed Woo themes.

public static get_local_woo_themes([bool $use_cache = true ]) : array<string|int, mixed>

Scanning every installed theme is expensive, so the result is cached for the rest of the request. Pass false after installing or removing a theme to rescan and refresh the cache.

Parameters
$use_cache : bool = true

Whether to return the cached list when one exists.

Tags
since
11.2.0

Added the $use_cache parameter.

Return values
array<string|int, mixed> —

get_notices()

Retrieve notice for connected store.

public static get_notices() : array<string|int, mixed>
Return values
array<string|int, mixed> — An array containing notice data.

get_plugin_auto_update_data()

Auto-update state of an installed plugin, following the same rules as WordPress core's Plugins screen so the two screens never describe the same plugin differently.

public static get_plugin_auto_update_data(string $plugin_file) : array{auto_update: bool, auto_update_manageable: bool}
Parameters
$plugin_file : string

Path to the plugin file relative to the plugins directory.

Tags
since
11.2.0
Return values
array{auto_update: bool, auto_update_manageable: bool} —

get_product_subscription_state()

Get subscription state of a given product ID.

public static get_product_subscription_state(int $product_id) : array<string|int, mixed>
Parameters
$product_id : int

The product id.

Tags
since

TBD

Return values
array<string|int, mixed> — Array of state_name => (bool) state

get_product_usage_notice_rules()

Get rules for displaying notice regarding marketplace product usage.

public static get_product_usage_notice_rules() : array<string|int, mixed>
Return values
array<string|int, mixed> — phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag.Missing -- As we wrap the throw in a try/catch.

get_subscription()

Get subscription data for a given product key.

public static get_subscription(string $product_key) : array<string|int, mixed>|bool
Parameters
$product_key : string

Subscription product key.

Return values
array<string|int, mixed>|bool — The array containing sub data or false.

get_subscription_install_url()

Get a subscriptions install URL.

public static get_subscription_install_url(string $product_key, string $product_slug) : string
Parameters
$product_key : string

Subscription product key.

$product_slug : string

Subscription product slug.

Return values
string —

get_subscription_list_data()

Get the connected user's subscription list data. Here, we merge connected subscriptions with locally installed Woo plugins and themes. We also add in information about available updates.

public static get_subscription_list_data() : array<string|int, mixed>

Used by the My Subscriptions page.

Return values
array<string|int, mixed> —

get_subscription_local_data()

Add local data to a subscription.

public static get_subscription_local_data(array<string|int, mixed> $subscription) : array<string|int, mixed>
Parameters
$subscription : array<string|int, mixed>

The subscription data.

Return values
array<string|int, mixed> — The subscription data with local data added.

get_subscriptions()

Get the connected user's subscriptions.

public static get_subscriptions() : array<string|int, mixed>
Return values
array<string|int, mixed> — phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag.Missing -- As we wrap the throw in a try/catch.

get_theme_auto_update_data()

Auto-update state of an installed theme, following the same rules as WordPress core's Themes screen.

public static get_theme_auto_update_data(string $stylesheet) : array{auto_update: bool, auto_update_manageable: bool}
Parameters
$stylesheet : string

Directory name of the theme.

Tags
since
11.2.0
Return values
array{auto_update: bool, auto_update_manageable: bool} —

get_unconnected_subscriptions()

Get the user's unconnected subscriptions.

public static get_unconnected_subscriptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —

get_view_filename()

Get an absolute path to the requested helper view.

public static get_view_filename(string $view) : string
Parameters
$view : string

The requested view file.

Return values
string — The absolute path to the view file.

has_product_subscription()

Checks whether current site has product subscription of a given ID.

public static has_product_subscription(int $product_id) : bool
Parameters
$product_id : int

The product id.

Tags
since
3.7.0
Return values
bool — Returns true if product subscription exists, false otherwise.

is_subscription_available()

Check if a subscription is available to use.

public static is_subscription_available(array<string|int, mixed> $subscription, array<string|int, mixed> $subscriptions) : bool

That is, is not already active and hasn't expired, and there are no other subscriptions for this product already active on this site.

Parameters
$subscription : array<string|int, mixed>

The subscription we're checking.

$subscriptions : array<string|int, mixed>

The list of all the user's subscriptions.

Return values
bool — True if multiple licenses exist, false otherwise.

is_subscription_installed()

Check if product relating to a subscription is installed.

public static is_subscription_installed(array<string|int, mixed> $subscription, array<string|int, mixed> $subscriptions) : bool

This method will return true if the product is installed, but will exclude subscriptions for the same product that are not in use. If a product is installed and inactive, this will ensure that one subscription is marked as installed.

Parameters
$subscription : array<string|int, mixed>

The subscription we're checking.

$subscriptions : array<string|int, mixed>

The list of all the user's subscriptions.

Return values
bool — True if installed, false otherwise.

log()

Log a helper event.

public static log(string $message[, string $level = 'info' ]) : void
Parameters
$message : string

Log message.

$level : string = 'info'

Optional, defaults to info, valid levels: emergency|alert|critical|error|warning|notice|info|debug.

Return values
void —

refresh_helper_subscriptions()

Flush helper authentication cache.

public static refresh_helper_subscriptions() : void
Tags
throws
Exception

If there is an error refreshing subscriptions.

Return values
void —

set_subscription_auto_update()

Turn auto-updates on or off for the plugin or theme backing a subscription.

public static set_subscription_auto_update(string $product_key, bool $enabled) : void

Writes the same auto_update_plugins / auto_update_themes site options WordPress core's Plugins and Themes screens write, so the change is identical to making it there.

Parameters
$product_key : string

Subscription product key.

$enabled : bool

Whether auto-updates should be on.

Tags
since
11.2.0
throws
Exception

If the subscription, or the product backing it, can't be acted on.

Return values
void —

update_auth_option()

Updates auth options and flushes cache

public static update_auth_option(string $access_token, string $access_token_secret, int $site_id, string $home_url) : void
Parameters
$access_token : string

The access token.

$access_token_secret : string

The secret access token.

$site_id : int

The site id returned by the API.

$home_url : string

Home url of the site.

Return values
void —

verify_request_hash()

Verify request hash created by WooCommerce.com.

public static verify_request_hash(string $request_hash) : bool
Parameters
$request_hash : string

request hash to be verified.

Return values
bool —

add_api_error_notice()

Adds at most one note signaling that there was an error with the WCCOM API.

protected static add_api_error_notice() : void
Return values
void —

get_available_subscription()

Get subscriptions for a product if it is available

protected static get_available_subscription(string|int $product_id) : mixed|null
Parameters
$product_id : string|int

the product id to get subscriptions for.

Return values
mixed|null —

get_message_for_response_code()

Gets a user-friendly error message based on the HTTP response code.

protected static get_message_for_response_code(int $code) : string
Parameters
$code : int

The HTTP response code.

Return values
string — The user-friendly error message.

remove_api_error_notice()

Remove all notes signaling an error with the WCCOM API, when the request was successful.

protected static remove_api_error_notice() : void
Return values
void —

wccom_activate()

Activate the product subscription to WCCOM

protected static wccom_activate(string $product_key) : array<string|int, mixed>
Parameters
$product_key : string

the product key to be activated.

Return values
array<string|int, mixed> —

_filter()

Filter an array of subscriptions by $filter.

private static _filter(array<string|int, mixed> &$subscriptions, string $filter) : void
Parameters
$subscriptions : array<string|int, mixed>

The subscriptions array, passed by ref.

$filter : string

The filter.

Return values
void —

_get_extensions_update_notice()

Get an update notice if one or more Woo extensions has an update available.

private static _get_extensions_update_notice() : string|null
Return values
string|null — The update notice or null if everything is up to date.

_get_local_from_product_id()

Get a local plugin/theme entry from product_id.

private static _get_local_from_product_id(int $product_id) : array<string|int, mixed>|bool
Parameters
$product_id : int

The product id.

Return values
array<string|int, mixed>|bool — The array containing the local plugin/theme data or false.

_get_return_notices()

Various success/error notices.

private static _get_return_notices() : array<string|int, mixed>

Runs during admin page render, so no headers/redirects here.

Return values
array<string|int, mixed> — Array pairs of message/type strings with notices.

_get_subscriptions_from_product_id()

Get a subscription entry from product_id. If multiple subscriptions are found with the same product id and $single is set to true, will return the first one in the list, so you can use this method to get things like extension name, version, etc.

private static _get_subscriptions_from_product_id(int $product_id[, bool $single = true ]) : array<string|int, mixed>|bool
Parameters
$product_id : int

The product id.

$single : bool = true

Whether to return a single subscription or all matching a product id.

Return values
array<string|int, mixed>|bool — The array containing sub data or false.

_woo_core_update_available()

Whether WooCommerce has an update available.

private static _woo_core_update_available() : bool
Return values
bool — True if a Woo core update is available.

filter_valid_subscriptions()

Filter malformed entries from subscription data.

private static filter_valid_subscriptions(array<string|int, mixed> $subscriptions) : array<string|int, mixed>
Parameters
$subscriptions : array<string|int, mixed>

Subscription entries.

Return values
array<string|int, mixed> —

get_all_plugin_keys()

Keys of every installed plugin, as auto_update_plugins stores them.

private static get_all_plugin_keys() : array<string|int, string>
Tags
since
11.2.0
Return values
array<string|int, string> —

get_all_theme_keys()

Stylesheets of every installed theme, as auto_update_themes stores them.

private static get_all_theme_keys() : array<string|int, string>
Tags
since
11.2.0
Return values
array<string|int, string> —

get_auto_update_data()

Shared auto-update state for a plugin or a theme.

private static get_auto_update_data("plugin"|"theme" $type, string $item_key) : array{auto_update: bool, auto_update_manageable: bool}
Parameters
$type : "plugin"|"theme"

The product type.

$item_key : string

Plugin file, or theme stylesheet.

Tags
since
11.2.0
Return values
array{auto_update: bool, auto_update_manageable: bool} —

get_auto_update_filter_payload()

Payload for the auto_update_plugin / auto_update_theme filters, matching what core's list tables pass so third-party callbacks see the same shape on both screens.

private static get_auto_update_filter_payload("plugin"|"theme" $type, string $item_key) : object
Parameters
$type : "plugin"|"theme"

The product type.

$item_key : string

Plugin file, or theme stylesheet.

Tags
since
11.2.0
Return values
object —

get_helper_redirect_url()

Get helper redirect URL.

private static get_helper_redirect_url([array<string|int, mixed> $args = array() ]) : string
Parameters
$args : array<string|int, mixed> = array()

Query args.

Return values
string —

get_source_page()

Get the source page for the connect URL (wc-admin or wc-addons/extensions)

private static get_source_page() : string
Return values
string —

get_subscriptions_url()

Get the URL of the My Subscriptions screen used in admin notices.

private static get_subscriptions_url() : string
Return values
string —

has_woo_header()

Whether an installed plugin or theme carries a Woo header, so the updater handles it.

private static has_woo_header(string $type, string $filename) : bool
Parameters
$type : string

'plugin' or 'theme'.

$filename : string

Plugin file, or a theme's stylesheet followed by /style.css.

Tags
since
11.2.0
Return values
bool —

maybe_redirect_to_new_marketplace_installer()

Maybe redirect to the new Marketplace installer.

private static maybe_redirect_to_new_marketplace_installer() : void
Return values
void —

record_api_error()

Record the last failed Helper API subscriptions response.

private static record_api_error(int $code, string $message) : void

The message is stored alongside the code because it is often more specific than anything we can rebuild from the status alone — a 401 carries reconnect guidance, a 422 explains an unparseable body. Where we do have purpose-written copy for a status, get_api_error() rebuilds it on read so it lands in the viewer's locale instead of the recording request's.

A 429 is held for the whole backoff window, otherwise the notice would disappear while requests are still being suppressed and the screen would silently revert to looking like an empty account.

Parameters
$code : int

HTTP status code, or 0 for a transport-level failure.

$message : string

Fallback message for failures with no HTTP status.

Return values
void —