WC_Settings_Shipping
extends WC_Settings_Page
in package
WC_Settings_Shipping.
Table of Contents
- $id : string
- Setting page id.
- $label : string
- Setting page label.
- __construct() : mixed
- Constructor.
- add_settings_page() : array<string|int, mixed>|mixed
- Add this page to settings.
- add_settings_slot() : mixed
- Creates the React mount point for settings slot.
- get_id() : string
- Get settings page ID.
- get_label() : string
- Get settings page label.
- get_sections() : array<string|int, mixed>
- Get all sections for this page, both the own ones and the ones defined via filters.
- get_settings() : array<string|int, mixed>
- Get settings array for the default section.
- get_settings_for_section() : array<string|int, mixed>
- Get settings array.
- output() : mixed
- Output the settings.
- output_sections() : mixed
- Output sections.
- save() : mixed
- Save settings.
- do_update_options_action() : mixed
- Trigger the 'woocommerce_update_options_'.id action.
- get_own_sections() : array<string|int, mixed>
- Get own sections.
- get_region_options() : mixed
- Get all available regions.
- get_settings_for_default_section() : array<string|int, mixed>
- Get settings for the default section.
- get_settings_for_options_section() : array<string|int, mixed>
- Get settings for the options section.
- get_settings_for_section_core() : array<string|int, mixed>
- Get the settings for a given section.
- get_shipping_methods() : array<string|int, mixed>
- Get the currently available shipping methods.
- instance_settings_screen() : mixed
- Show instance settings
- output_shipping_class_screen() : mixed
- Handles output of the shipping class settings screen.
- output_zones_screen() : mixed
- Handles output of the shipping zones page in admin.
- save_settings_for_current_section() : mixed
- Save settings for current section.
- wc_is_installing() : bool
- Is WC_INSTALLING constant defined? This method exists to ease unit testing.
- zone_methods_screen() : mixed
- Show method for a zone
- zones_screen() : mixed
- Show zones
Properties
$id
Setting page id.
protected
string
$id
= ''
$label
Setting page label.
protected
string
$label
= ''
Methods
__construct()
Constructor.
public
__construct() : mixed
Return values
mixed —add_settings_page()
Add this page to settings.
public
add_settings_page(array<string|int, mixed> $pages) : array<string|int, mixed>|mixed
Parameters
- $pages : array<string|int, mixed>
-
Current pages.
Return values
array<string|int, mixed>|mixed —add_settings_slot()
Creates the React mount point for settings slot.
public
add_settings_slot() : mixed
Return values
mixed —get_id()
Get settings page ID.
public
get_id() : string
Tags
Return values
string —get_label()
Get settings page label.
public
get_label() : string
Tags
Return values
string —get_sections()
Get all sections for this page, both the own ones and the ones defined via filters.
public
get_sections() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_settings()
Get settings array for the default section.
public
get_settings() : array<string|int, mixed>
External settings classes (registered via 'woocommerce_get_settings_pages' filter) might have redefined this method as "get_settings($section_id='')", thus we need to use this method internally instead of 'get_settings_for_section' to register settings and render settings pages.
But we can't just redefine the method as "get_settings($section_id='')" here, since this will break on PHP 8 if any external setting class have it as 'get_settings()'.
Thus we leave the method signature as is and use 'func_get_arg' to get the setting id if it's supplied, and we use this method internally; but it's deprecated and should otherwise never be used.
Tags
Return values
array<string|int, mixed> — Settings array, each item being an associative array representing a setting.get_settings_for_section()
Get settings array.
public
final get_settings_for_section(string $section_id) : array<string|int, mixed>
The strategy for getting the settings is as follows:
-
If a method named 'get_settings_for_{section_id}_section' exists in the class it will be invoked (for the default '' section, the method name is 'get_settings_for_default_section'). Derived classes can implement these methods as required.
-
Otherwise, 'get_settings_for_section_core' will be invoked. Derived classes can override it as an alternative to implementing 'get_settings_for_{section_id}_section' methods.
Parameters
- $section_id : string
-
The id of the section to return settings for, an empty string for the default section.
Return values
array<string|int, mixed> — Settings array, each item being an associative array representing a setting.output()
Output the settings.
public
output() : mixed
Return values
mixed —output_sections()
Output sections.
public
output_sections() : mixed
Return values
mixed —save()
Save settings.
public
save() : mixed
Return values
mixed —do_update_options_action()
Trigger the 'woocommerce_update_options_'.id action.
protected
do_update_options_action([string $section_id = null ]) : mixed
Parameters
- $section_id : string = null
-
Section to trigger the action for, or null for current section.
Return values
mixed —get_own_sections()
Get own sections.
protected
get_own_sections() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_region_options()
Get all available regions.
protected
get_region_options(int $allowed_countries, int $shipping_continents) : mixed
Parameters
- $allowed_countries : int
-
Zone ID.
- $shipping_continents : int
-
Zone ID.
Return values
mixed —get_settings_for_default_section()
Get settings for the default section.
protected
get_settings_for_default_section() : array<string|int, mixed>
The original implementation of 'get_settings' was returning the settings for the "Options" section when the supplied value for $current_section was ''.
Return values
array<string|int, mixed> —get_settings_for_options_section()
Get settings for the options section.
protected
get_settings_for_options_section() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_settings_for_section_core()
Get the settings for a given section.
protected
get_settings_for_section_core(string $section_id) : array<string|int, mixed>
This method is invoked from 'get_settings_for_section' when no 'get_settings_for_{current_section}_section' method exists in the class.
When overriding, note that the 'woocommerce_get_settings_' filter must NOT be triggered, as this is already done by 'get_settings_for_section'.
Parameters
- $section_id : string
-
The section name to get the settings for.
Return values
array<string|int, mixed> — Settings array, each item being an associative array representing a setting.get_shipping_methods()
Get the currently available shipping methods.
protected
get_shipping_methods() : array<string|int, mixed>
This method exists to ease unit testing.
Return values
array<string|int, mixed> — Currently available shipping methods.instance_settings_screen()
Show instance settings
protected
instance_settings_screen(int $instance_id) : mixed
Parameters
- $instance_id : int
-
Shipping instance ID.
Return values
mixed —output_shipping_class_screen()
Handles output of the shipping class settings screen.
protected
output_shipping_class_screen() : mixed
Return values
mixed —output_zones_screen()
Handles output of the shipping zones page in admin.
protected
output_zones_screen() : mixed
Return values
mixed —save_settings_for_current_section()
Save settings for current section.
protected
save_settings_for_current_section() : mixed
Return values
mixed —wc_is_installing()
Is WC_INSTALLING constant defined? This method exists to ease unit testing.
protected
wc_is_installing() : bool
Return values
bool — True is the WC_INSTALLING constant is defined.zone_methods_screen()
Show method for a zone
protected
zone_methods_screen(int $zone_id) : mixed
Parameters
- $zone_id : int
-
Zone ID.
Return values
mixed —zones_screen()
Show zones
protected
zones_screen() : mixed