Tax_Handler implements Registerable, Standard_Service
Handles the frontend display and saving of custom registration fields
Tags
Interfaces, Classes and Traits
- Registerable
- Standard_Service
Table of Contents
- calc_tax() : array<string|int, mixed>
- Filter the tax calculation based on the wholesale role
- manage_tax_display_shop() : string
- Filters the WC tax display in shop setting to respect the tax status
- manage_tax_for_customer() : mixed
- Sets the current customer tax exempt state
- register() : mixed
- {@inheritdoc}
- get_tax_display_mode() : string
- Determine the tax display mode (shop) for a wholesale role
- is_tax_exempt() : bool
- Determine if a wholesale role is tax exempt
Methods
calc_tax()
Filter the tax calculation based on the wholesale role
public
calc_tax(array<string|int, mixed> $taxes, float $price, array<string|int, mixed> $rates, bool $price_includes_tax) : array<string|int, mixed>
This method uses the 'wcwp_prices_follow_tax_display' filter to determine
whether the original price follows the tax display mode set in the wholesale role.
If the tax display mode is set to 'excl' and wcwp_prices_follow_tax_display
returns true,
then the price is considered to be exclusive of taxes.
Parameters
- $taxes : array<string|int, mixed>
-
The calculated taxes
- $price : float
-
The product price
- $rates : array<string|int, mixed>
-
The tax rates
- $price_includes_tax : bool
-
Whether the price includes tax
Tags
Return values
array<string|int, mixed> —$taxes
manage_tax_display_shop()
Filters the WC tax display in shop setting to respect the tax status
public
manage_tax_display_shop(string $pre_option) : string
Parameters
- $pre_option : string
Tags
Return values
string —$pre_option
manage_tax_for_customer()
Sets the current customer tax exempt state
public
manage_tax_for_customer() : mixed
Tags
Return values
mixed —register()
{@inheritdoc}
public
register() : mixed
Tags
Return values
mixed —get_tax_display_mode()
Determine the tax display mode (shop) for a wholesale role
private
get_tax_display_mode(Wholesale_Role $role, string $current_option) : string
Parameters
- $role : Wholesale_Role
- $current_option : string
Tags
Return values
string —$tax_display_mode
is_tax_exempt()
Determine if a wholesale role is tax exempt
private
is_tax_exempt(Wholesale_Role $role) : bool
Parameters
- $role : Wholesale_Role
Tags
Return values
bool —$exempt