CashOnDelivery
extends AbstractPaymentMethodType
in package
Cash on Delivery (COD) payment method integration
Tags
Table of Contents
- $name : string
- Payment method name/id/slug (matches id in WC_Gateway_COD in core).
- $settings : array<string|int, mixed>
- Settings from the WP options table
- $asset_api : Api
- An instance of the Asset Api
- __construct() : mixed
- Constructor
- get_editor_script_handles() : array<string|int, string>
- Returns an array of script handles to enqueue in the admin context.
- get_name() : mixed
- Returns the name of the payment method.
- get_payment_method_data() : array<string|int, mixed>
- Returns an array of key=>value pairs of data made available to the payment methods script.
- get_payment_method_script_handles() : array<string|int, mixed>
- Returns an array of scripts/handles to be registered for this payment method.
- get_payment_method_script_handles_for_admin() : array<string|int, string>
- Returns an array of script handles to enqueue for this payment method in the admin context
- get_script_data() : array<string|int, mixed>
- An array of key, value pairs of data made available to the block on the client side.
- get_script_handles() : array<string|int, string>
- Returns an array of script handles to enqueue in the frontend context.
- get_supported_features() : array<string|int, string>
- Returns an array of supported features.
- initialize() : mixed
- Initializes the payment method type.
- is_active() : bool
- Returns if this payment method should be active. If false, the scripts will not be enqueued.
- get_setting() : mixed
- Get a setting from the settings array if set.
- get_enable_for_methods() : array<string|int, mixed>
- Return enable_for_methods option.
- get_enable_for_virtual() : bool
- Return enable_for_virtual option.
Properties
$name
Payment method name/id/slug (matches id in WC_Gateway_COD in core).
protected
string
$name
= 'cod'
$settings
Settings from the WP options table
protected
array<string|int, mixed>
$settings
= []
$asset_api
An instance of the Asset Api
private
Api
$asset_api
Methods
__construct()
Constructor
public
__construct(Api $asset_api) : mixed
Parameters
- $asset_api : Api
-
An instance of Api.
Return values
mixed —get_editor_script_handles()
Returns an array of script handles to enqueue in the admin context.
public
get_editor_script_handles() : array<string|int, string>
Alias of get_payment_method_script_handles_for_admin. Defined by IntegrationInterface.
Return values
array<string|int, string> —get_name()
Returns the name of the payment method.
public
get_name() : mixed
Return values
mixed —get_payment_method_data()
Returns an array of key=>value pairs of data made available to the payment methods script.
public
get_payment_method_data() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_payment_method_script_handles()
Returns an array of scripts/handles to be registered for this payment method.
public
get_payment_method_script_handles() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_payment_method_script_handles_for_admin()
Returns an array of script handles to enqueue for this payment method in the admin context
public
get_payment_method_script_handles_for_admin() : array<string|int, string>
Return values
array<string|int, string> —get_script_data()
An array of key, value pairs of data made available to the block on the client side.
public
get_script_data() : array<string|int, mixed>
Alias of get_payment_method_data. Defined by IntegrationInterface.
Return values
array<string|int, mixed> —get_script_handles()
Returns an array of script handles to enqueue in the frontend context.
public
get_script_handles() : array<string|int, string>
Alias of get_payment_method_script_handles. Defined by IntegrationInterface.
Return values
array<string|int, string> —get_supported_features()
Returns an array of supported features.
public
get_supported_features() : array<string|int, string>
Return values
array<string|int, string> —initialize()
Initializes the payment method type.
public
initialize() : mixed
Return values
mixed —is_active()
Returns if this payment method should be active. If false, the scripts will not be enqueued.
public
is_active() : bool
Return values
bool —get_setting()
Get a setting from the settings array if set.
protected
get_setting(string $name[, mixed $default = '' ]) : mixed
Parameters
- $name : string
-
Setting name.
- $default : mixed = ''
-
Value that is returned if the setting does not exist.
Return values
mixed —get_enable_for_methods()
Return enable_for_methods option.
private
get_enable_for_methods() : array<string|int, mixed>
Return values
array<string|int, mixed> — Array of shipping methods (string ids) that allow COD. (If empty, all support COD.)get_enable_for_virtual()
Return enable_for_virtual option.
private
get_enable_for_virtual() : bool