WooCommerce Code Reference

Payments extends Task
in package

Payments 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 millisecond mapping.
$task_list  : TaskList
Parent task list.
$is_complete_result  : null
Used to cache is_complete() method result.
__construct()  : mixed
Constructor
can_view()  : bool
Task visibility.
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
The task action URL.
get_additional_data()  : array<string|int, mixed>
Additional data to be passed to the front-end JS logic.
get_additional_info()  : string
Additional info.
get_badge()  : string
Badge.
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_gateways()  : bool
Check if the store has any enabled gateways.
has_previously_completed()  : bool
Check if a task list has previously been marked as complete.
has_providers_enabled_other_than_woopayments()  : bool
Check if the store has any enabled providers other than WooPayments.
is_actioned()  : bool
Check if a task has been actioned.
is_active()  : mixed
Check if this is the active task.
is_always_accessible()  : bool
If a task is always accessible, relevant for when a task list is hidden but a task can still be viewed.
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_track_completion()  : void
Track task completion if task is viewable and is complete.
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.
get_payments_extension_suggestions()  : array<string|int, mixed>
Get the list of payments extension suggestions as it is used on the Payments Settings page.
get_payments_providers()  : array<string|int, mixed>
Get the list of payments providers as it is used on the Payments Settings page.
get_payments_settings_country()  : string
Get the store's business registration country/location as it is used on the Payments Settings page.
get_woopayments_provider()  : array<string|int, mixed>|null
Get the WooPayments provider details from the list used on the Payments Settings page.
get_woopayments_suggestion()  : array<string|int, mixed>|null
Get the WooPayments payments extension suggestion details from the lists used on the Payments Settings page.
has_online_gateways()  : bool
Check if the store has any enabled online gateways.
has_providers_needing_setup_other_than_woopayments()  : bool
Check if any non-WooPayments providers need setup.
has_woopayments_test_account()  : bool
Check if WooPayments is onboarded and has a test [drive] account.
is_woopayments_active()  : bool
Check if the WooPayments plugin is active.
is_woopayments_installed()  : bool
Check if the WooPayments plugin is installed.
is_woopayments_onboarded()  : bool
Check if WooPayments is completely onboarded.
is_woopayments_supported_country()  : bool
Check if the store is in a WooPayments-supported geography.

Constants

Properties

$duration_to_ms

Duration to millisecond 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_additional_data()

Additional data to be passed to the front-end JS logic.

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

Primarily used to inform the behavior of the Payments task in the LYS context.

Return values
array<string|int, mixed>

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_always_accessible()

If a task is always accessible, relevant for when a task list is hidden but a task can still be viewed.

public is_always_accessible() : bool
Return values
bool

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

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

get_payments_extension_suggestions()

Get the list of payments extension suggestions as it is used on the Payments Settings page.

private get_payments_extension_suggestions() : array<string|int, mixed>
Return values
array<string|int, mixed>The list of payments extension suggestions.

get_payments_providers()

Get the list of payments providers as it is used on the Payments Settings page.

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

The list can include payments extension suggestions, the same as on the Payments Settings page.

Return values
array<string|int, mixed>The list of payments providers.

get_payments_settings_country()

Get the store's business registration country/location as it is used on the Payments Settings page.

private get_payments_settings_country() : string
Return values
stringThe business registration country/location code.

get_woopayments_provider()

Get the WooPayments provider details from the list used on the Payments Settings page.

private get_woopayments_provider() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullThe WooPayments provider details or null if not found.

get_woopayments_suggestion()

Get the WooPayments payments extension suggestion details from the lists used on the Payments Settings page.

private get_woopayments_suggestion() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullThe WooPayments suggestion details or null if not found.

is_woopayments_supported_country()

Check if the store is in a WooPayments-supported geography.

private is_woopayments_supported_country(string $country_code) : bool
Parameters
$country_code : string

Country code to check. If not provided, uses store base country.

Return values
boolWhether the country is supported by WooPayments.