Wholesale_Price
Controller to get wholesale pricing
Tags
Table of Contents
- $product : WC_Product
- The current product
- $role : Wholesale_Role
- The current role
- $transient_key : mixed
- The transient used to store the price
- __construct() : mixed
- Constructor.
- get_final_price() : mixed
- Get the final price of a product
- get_price() : mixed
- Retrieve the wholesale price.
- get_sale_price() : mixed
- Retrieve the wholesale sale price.
- calculate_product_price() : false|float
- Calculate the correct price for a wholesale role
- get_category_discount() : mixed
- get_category_pricing() : false|float
- Retrieve the Category Pricing if available
- get_global_pricing() : false|float
- Retrieve Global pricing if available
- get_pricing() : string
- Retrieve the pricing for a product
- get_product_pricing() : false|float
- Retrieve product pricing if available
- get_product_sale_pricing() : false|float
- Retrieve product sale pricing if available
Properties
$product
The current product
private
WC_Product
$product
Tags
$role
The current role
private
Wholesale_Role
$role
Tags
$transient_key
The transient used to store the price
private
mixed
$transient_key
Tags
Methods
__construct()
Constructor.
public
__construct([WC_Product|null $product = null ][, Wholesale_Role|null $role = null ]) : mixed
Parameters
- $product : WC_Product|null = null
- $role : Wholesale_Role|null = null
Tags
Return values
mixed —get_final_price()
Get the final price of a product
public
get_final_price() : mixed
This is just a shorthand of the get_sale_price()
method
that ultimately returns the product price if no sale price is available,
which corresponds to the following two scenarios:
- the product does not have a product-specific wholesale sale price
- the wholesale role does not enjoy discounts on the retail sale price
This shorthand is aimed at dispelling any confusion that may arise
when the get_sale_price()
method is called in the code
with the intention of getting the final price of a product.
Tags
Return values
mixed —get_price()
Retrieve the wholesale price.
public
get_price() : mixed
Tags
Return values
mixed —get_sale_price()
Retrieve the wholesale sale price.
public
get_sale_price() : mixed
Tags
Return values
mixed —calculate_product_price()
Calculate the correct price for a wholesale role
private
calculate_product_price() : false|float
Tags
Return values
false|float —$price_hash
get_category_discount()
private
get_category_discount() : mixed
Tags
Return values
mixed —get_category_pricing()
Retrieve the Category Pricing if available
private
get_category_pricing() : false|float
Tags
Return values
false|float —get_global_pricing()
Retrieve Global pricing if available
private
get_global_pricing() : false|float
Tags
Return values
false|float —get_pricing()
Retrieve the pricing for a product
private
get_pricing() : string
Tags
Return values
string —get_product_pricing()
Retrieve product pricing if available
private
get_product_pricing() : false|float
Tags
Return values
false|float —$product_price
get_product_sale_pricing()
Retrieve product sale pricing if available
private
get_product_sale_pricing() : false|float
Tags
Return values
false|float —$product_sale_price