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

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_rest_routes()  : mixed
Registers the REST routes for the featured products and product previews endpoints.

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