WooCommerce Code Reference

TransientNotices
in package

Shows print shipping label banner on edit order page.

Table of Contents

QUEUE_OPTION  = 'woocommerce_admin_transient_notices_queue'
Option name for the queue.
__construct()  : mixed
Constructor
add()  : mixed
Add a notice to be shown.
get()  : array<string|int, mixed>|null
Get a notice by ID.
get_queue()  : array<string|int, mixed>
Get all notices in the queue.
get_queue_by_user()  : array<string|int, mixed>
Get all notices in the queue by a given user ID.
preload_options()  : array<string|int, mixed>
Preload options to prime state of the application.
remove()  : mixed
Remove a notice by ID.

Constants

Methods

add()

Add a notice to be shown.

public static add(array<string|int, mixed> $notice) : mixed
Parameters
$notice : array<string|int, mixed>

Notice. $notice = array( 'id' => (string) Unique ID for the notice. Required. 'user_id' => (int|null) User ID to show the notice to. 'status' => (string) info|error|success 'content' => (string) Content to be shown for the notice. Required. 'options' => (array) Array of options to be passed to the notice component. See https://developer.wordpress.org/block-editor/reference-guides/data/data-core-notices/#createNotice for available options. ).

Return values
mixed

get()

Get a notice by ID.

public static get(array<string|int, mixed> $notice_id) : array<string|int, mixed>|null
Parameters
$notice_id : array<string|int, mixed>

Notice of ID to get.

Return values
array<string|int, mixed>|null

get_queue_by_user()

Get all notices in the queue by a given user ID.

public static get_queue_by_user(int $user_id) : array<string|int, mixed>
Parameters
$user_id : int

User ID.

Return values
array<string|int, mixed>

preload_options()

Preload options to prime state of the application.

public preload_options(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed>

Array of options to preload.

Return values
array<string|int, mixed>

remove()

Remove a notice by ID.

public static remove(array<string|int, mixed> $notice_id) : mixed
Parameters
$notice_id : array<string|int, mixed>

Notice of ID to remove.

Return values
mixed