WooCommerce Code Reference

Products extends Task
in package

Products Task

Table of Contents

ACTIONED_OPTION  = 'woocommerce_task_list_tracked_completed_actions'
Name of the actioned option.
ACTIVE_TASK_TRANSIENT  = 'wc_onboarding_active_task'
Name of the active task transient.
COMPLETED_OPTION  = 'woocommerce_task_list_tracked_completed_tasks'
Option name of completed tasks.
DISMISSED_OPTION  = 'woocommerce_task_list_dismissed_tasks'
Name of the dismiss option.
SNOOZED_OPTION  = 'woocommerce_task_list_remind_me_later_tasks'
Name of the snooze option.
$duration_to_ms  : string
Duration to milisecond mapping.
$task_list  : TaskList
Parent task list.
__construct()  : mixed
Constructor
can_view()  : bool
Check if the store is capable of viewing the task.
convert_object_to_camelcase()  : object
Convert object keys to camelcase.
dismiss()  : bool
Dismiss the task.
get_action_label()  : string
Action label.
get_action_url()  : string
Action URL.
get_additional_data()  : array<string|int, mixed>
Addtional data.
get_additional_info()  : string
Additional info.
get_content()  : string
Content.
get_id()  : string
ID.
get_json()  : array<string|int, mixed>
Get the task as JSON.
get_level()  : string
Level.
get_list_id()  : string
Get the task list ID.
get_parent_id()  : string
Parent ID.
get_parent_option()  : mixed|null
Get custom option.
get_parent_options()  : array<string|int, mixed>
Get task list options.
get_record_view_event()  : bool
Check if should record event when task is viewed
get_snoozed_until()  : string
Get the snoozed until datetime.
get_time()  : string
Time.
get_title()  : string
Title.
has_previously_completed()  : bool
Check if a task list has previously been marked as complete.
has_products()  : bool
Check if the store has any published products.
is_actioned()  : bool
Check if a task has been actioned.
is_active()  : mixed
Check if this is the active task.
is_complete()  : bool
Task completion.
is_disabled()  : bool
Check if task is disabled.
is_dismissable()  : bool
Check if a task is dismissable.
is_dismissed()  : bool
Bool for task dismissal.
is_snoozeable()  : bool
Check if a task is snoozeable.
is_snoozed()  : bool
Bool for task snoozed.
is_task_actioned()  : bool
Check if a provided task ID has been actioned.
is_visited()  : bool
Check if the task has been visited.
mark_actioned()  : bool
Mark a task as actioned. Used to verify an action has taken place in some tasks.
possibly_add_import_return_notice_script()  : mixed
Adds a return to task list notice when completing the import product task.
possibly_add_load_sample_return_notice_script()  : mixed
Adds a return to task list notice when completing the loading sample products action.
possibly_add_manual_return_notice_script()  : mixed
Adds a return to task list notice when completing the manual product task.
possibly_track_completion()  : mixed
Track task completion if task is viewable.
prefix_event()  : string
Prefix event for track event naming.
record_tracks_event()  : string
Record a tracks event with the prefixed event name.
set_active()  : mixed
Set this as the active task across page loads.
snooze()  : bool
Snooze the task.
sort()  : int
Sorting function for tasks.
undo_dismiss()  : bool
Undo task dismissal.
undo_snooze()  : bool
Undo task snooze.

Constants

Properties

$duration_to_ms

Duration to milisecond mapping.

protected string $duration_to_ms = array('day' => DAY_IN_SECONDS * 1000, 'hour' => HOUR_IN_SECONDS * 1000, 'week' => WEEK_IN_SECONDS * 1000)

Methods

convert_object_to_camelcase()

Convert object keys to camelcase.

public static convert_object_to_camelcase(array<string|int, mixed> $data) : object
Parameters
$data : array<string|int, mixed>

Data to convert.

Return values
object

get_parent_option()

Get custom option.

public get_parent_option(string $option_name) : mixed|null
Parameters
$option_name : string

name of custom option.

Return values
mixed|null

is_task_actioned()

Check if a provided task ID has been actioned.

public static is_task_actioned(string $id) : bool
Parameters
$id : string

Task ID.

Return values
bool

possibly_add_import_return_notice_script()

Adds a return to task list notice when completing the import product task.

public possibly_add_import_return_notice_script(string $hook) : mixed
Parameters
$hook : string

Page hook.

Return values
mixed

possibly_add_load_sample_return_notice_script()

Adds a return to task list notice when completing the loading sample products action.

public possibly_add_load_sample_return_notice_script(string $hook) : mixed
Parameters
$hook : string

Page hook.

Return values
mixed

possibly_add_manual_return_notice_script()

Adds a return to task list notice when completing the manual product task.

public possibly_add_manual_return_notice_script(string $hook) : mixed
Parameters
$hook : string

Page hook.

Return values
mixed

prefix_event()

Prefix event for track event naming.

public prefix_event(string $event_name) : string
Parameters
$event_name : string

Event name.

Return values
string

record_tracks_event()

Record a tracks event with the prefixed event name.

public record_tracks_event(string $event_name[, array<string|int, mixed> $args = array() ]) : string
Parameters
$event_name : string

Event name.

$args : array<string|int, mixed> = array()

Array of tracks arguments.

Return values
stringPrefixed event name.

snooze()

Snooze the task.

public snooze([string $duration = 'day' ]) : bool
Parameters
$duration : string = 'day'

Duration to snooze. day|hour|week.

Tags
deprecated
7.2.0
Return values
bool

sort()

Sorting function for tasks.

public static sort(Task $a, Task $b[, array<string|int, mixed> $sort_by = array() ]) : int
Parameters
$a : Task

Task a.

$b : Task

Task b.

$sort_by : array<string|int, mixed> = array()

list of columns with sort order.

Return values
int