Wholesale_Role
Controller to manage wholesale role operations
Tags
Table of Contents
- $apply_to_sale_price_option : mixed
- $data : array<string|int, mixed>
- Default data for a wholesale role
- $default_role_option : string
- Reference for wp_options keys
- $discount_option : mixed
- $pricing_option : mixed
- $sale_pricing_option : mixed
- $tax_display_shop_option : mixed
- $tax_option : mixed
- __construct() : mixed
- Constructor.
- delete() : mixed
- Delete a role
- get_apply_to_sale_price() : string
- Gets the apply-to-sale-price status
- get_data() : array<string|int, mixed>
- Returns the wholesale role data
- get_default() : string
- Gets the default status
- get_disable_tax() : string
- Gets the disable tax status
- get_display_name() : string
- Gets the role display name
- get_global_discount() : int
- Gets the global discount amount
- get_name() : string
- Gets the role name as used by WP
- get_product_pricing() : string
- Gets the product pricing status
- get_product_sale_pricing() : string
- Gets the product sale pricing status
- get_tax_display_shop() : string
- Gets the price display status
- get_user_count() : int
- Get the number of users with this role
- update() : mixed
- Update a role
- delete_group_option() : bool
- Deletes a role's data from a group option
- read_group_option() : string|int|bool
- Reads role data from inside a group option
- set_default() : mixed
- Sets the role as the default role.
- set_display_name() : mixed
- Creates a new role or updates the display name
- set_group_option() : mixed
- Sets role data inside a group option
- update_roles_with_sale_pricing() : void
- Update the
Properties
$apply_to_sale_price_option
protected
mixed
$apply_to_sale_price_option
= 'wcwp_apply_to_sale_price'
Tags
$data
Default data for a wholesale role
protected
array<string|int, mixed>
$data
= ['name' => false, 'display_name' => '', 'default' => 'no', 'global_discount' => 0, 'disable_tax' => 'inherit', 'product_pricing' => 'no', 'product_sale_pricing' => 'no', 'apply_to_sale_price' => 'no', 'tax_display_shop' => 'inherit']
Tags
$default_role_option
Reference for wp_options keys
protected
string
$default_role_option
= 'wcwp_default_role'
Tags
$discount_option
protected
mixed
$discount_option
= 'wcwp_global_discounts'
Tags
$pricing_option
protected
mixed
$pricing_option
= 'wcwp_product_pricing'
Tags
$sale_pricing_option
protected
mixed
$sale_pricing_option
= 'wcwp_product_sale_pricing'
Tags
$tax_display_shop_option
protected
mixed
$tax_display_shop_option
= 'wcwp_tax_display_shop_role'
Tags
$tax_option
protected
mixed
$tax_option
= 'wcwp_disable_tax_role'
Tags
Methods
__construct()
Constructor.
public
__construct([string $name = 'new' ]) : mixed
Parameters
- $name : string = 'new'
Tags
Return values
mixed —delete()
Delete a role
public
delete() : mixed
Tags
Return values
mixed —get_apply_to_sale_price()
Gets the apply-to-sale-price status
public
get_apply_to_sale_price() : string
Tags
Return values
string —get_data()
Returns the wholesale role data
public
get_data() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —get_default()
Gets the default status
public
get_default() : string
Tags
Return values
string —get_disable_tax()
Gets the disable tax status
public
get_disable_tax() : string
Tags
Return values
string —get_display_name()
Gets the role display name
public
get_display_name() : string
Tags
Return values
string —get_global_discount()
Gets the global discount amount
public
get_global_discount() : int
Tags
Return values
int —get_name()
Gets the role name as used by WP
public
get_name() : string
Tags
Return values
string —get_product_pricing()
Gets the product pricing status
public
get_product_pricing() : string
Tags
Return values
string —get_product_sale_pricing()
Gets the product sale pricing status
public
get_product_sale_pricing() : string
Tags
Return values
string —get_tax_display_shop()
Gets the price display status
public
get_tax_display_shop() : string
Tags
Return values
string —get_user_count()
Get the number of users with this role
public
get_user_count() : int
Tags
Return values
int —update()
Update a role
public
update(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
Tags
Return values
mixed —delete_group_option()
Deletes a role's data from a group option
private
delete_group_option(string $option_key[, bool $autoload = false ]) : bool
Parameters
- $option_key : string
- $autoload : bool = false
Tags
Return values
bool —read_group_option()
Reads role data from inside a group option
private
read_group_option(string $option_key) : string|int|bool
Parameters
- $option_key : string
Tags
Return values
string|int|bool —set_default()
Sets the role as the default role.
private
set_default(string $default) : mixed
Parameters
- $default : string
Tags
Return values
mixed —set_display_name()
Creates a new role or updates the display name
private
set_display_name(string $display_name) : mixed
Parameters
- $display_name : string
Tags
Return values
mixed —set_group_option()
Sets role data inside a group option
private
set_group_option(string $option_key, string|int|bool $value[, bool $autoload = false ]) : mixed
Parameters
- $option_key : string
- $value : string|int|bool
- $autoload : bool = false
Tags
Return values
mixed —update_roles_with_sale_pricing()
Update the
private
update_roles_with_sale_pricing(mixed $is_sale_pricing_active) : void
Parameters
- $is_sale_pricing_active : mixed