WooCommerce Code Reference

WC_Helper_Admin
in package

WC_Helper Class

The main entry-point for all things related to the Helper. The Helper manages the connection between the store and an account on WooCommerce.com.

Table of Contents

CACHE_TOOL_ID  = 'clear_woocommerce_helper_cache'
Clear cache tool identifier.
add_marketplace_settings()  : mixed
Pushes settings onto the WooCommerce Admin global settings object (wcSettings).
get_connection_url()  : string
Generates the URL for connecting or disconnecting the store to/from WooCommerce.com.
get_featured()  : mixed
Fetch featured products from WooCommerce.com and serve them as JSON.
get_permission()  : mixed
The Extensions page can only be accessed by users with the manage_woocommerce capability. So the API mimics that behavior.
get_product_preview()  : mixed
Fetch data for product previews from WooCommerce.com.
load()  : void
Loads the class, runs on init
register_cache_clear_tool()  : array<string|int, mixed>
Register the cache clearing tool on the WooCommerce > Status > Tools page.
register_rest_routes()  : mixed
Registers the REST routes for the featured products and product previews endpoints.
run_clear_cache_tool()  : mixed
"Clear" helper cache by invalidating it.

Constants

Methods

add_marketplace_settings()

Pushes settings onto the WooCommerce Admin global settings object (wcSettings).

public static add_marketplace_settings(mixed $settings) : mixed
Parameters
$settings : mixed

The settings object we're amending.

Return values
mixed$settings

get_connection_url()

Generates the URL for connecting or disconnecting the store to/from WooCommerce.com.

public static get_connection_url([bool $reconnect = false ]) : string

Approach taken from existing helper code that isn't exposed.

Parameters
$reconnect : bool = false

indicate if the site is being reconnected.

Return values
string

get_permission()

The Extensions page can only be accessed by users with the manage_woocommerce capability. So the API mimics that behavior.

public static get_permission() : mixed
Return values
mixed

get_product_preview()

Fetch data for product previews from WooCommerce.com.

public static get_product_preview(WP_REST_Request $request) : mixed
Parameters
$request : WP_REST_Request

Request object.

Return values
mixed

register_cache_clear_tool()

Register the cache clearing tool on the WooCommerce > Status > Tools page.

public static register_cache_clear_tool(array<string|int, mixed> $debug_tools) : array<string|int, mixed>
Parameters
$debug_tools : array<string|int, mixed>

Available debug tool registrations.

Return values
array<string|int, mixed>Filtered debug tool registrations.