Bundle_Tier
Class Bundle_Tier Holds the information for a Bundle tier.
Tags
Table of Contents
- $description : string
- $discount : float
- $discount_type : string
- $popular : bool
- $popular_label : string
- $product : WC_Product
- $quantity : int
- __construct() : mixed
- Bundle_Tier constructor.
- get_bundle_title() : string
- Get the label text for the bundle tier (e.g., "Buy 5").
- get_discount() : float
- Get the discount amount
- get_discount_description() : string
- Get the discount description.
- get_discount_type() : string
- Get the discount type.
- get_discounted_bundle_price() : float
- Calculate the discounted price for this bundle tier.
- get_formatted_tier_price_display() : string
- Get the formatted HTML price display for this bundle tier.
- get_popular() : bool
- Get the popular state for the bundle
- get_popular_label() : string
- Get the popular label for the bundle
- get_product() : WC_Product
- Get the product.
- get_quantity() : int
- Get the product quantity
- get_tier_prices() : array<string|int, mixed>
- Calculate original and final prices for this tier based on the total original price.
Properties
$description
protected
string
$description
$discount
protected
float
$discount
$discount_type
protected
string
$discount_type
$popular
protected
bool
$popular
$popular_label
protected
string
$popular_label
$product
protected
WC_Product
$product
$quantity
protected
int
$quantity
Methods
__construct()
Bundle_Tier constructor.
public
__construct(WC_Product $product, int $quantity, float $discount, string $discount_type, string $description, bool $popular, string $popular_label) : mixed
Parameters
- $product : WC_Product
-
The product.
- $quantity : int
-
The amount of products.
- $discount : float
-
The discount amount.
- $discount_type : string
-
The discount type.
- $description : string
-
The offer description.
- $popular : bool
-
If the offer is popular or not.
- $popular_label : string
-
The label for the highlighted item.
Return values
mixed —get_bundle_title()
Get the label text for the bundle tier (e.g., "Buy 5").
public
get_bundle_title() : string
Return values
string —get_discount()
Get the discount amount
public
get_discount() : float
Return values
float —get_discount_description()
Get the discount description.
public
get_discount_description() : string
Return values
string —get_discount_type()
Get the discount type.
public
get_discount_type() : string
Return values
string —percentage or value
get_discounted_bundle_price()
Calculate the discounted price for this bundle tier.
public
get_discounted_bundle_price(float $total_original_price) : float
Parameters
- $total_original_price : float
-
The total price before any bundle discount (base_price * quantity).
Return values
float —The discounted price after applying the bundle discount.
get_formatted_tier_price_display()
Get the formatted HTML price display for this bundle tier.
public
get_formatted_tier_price_display(float|null $total_original_price) : string
Parameters
- $total_original_price : float|null
-
The total original price (base_price * quantity).
Return values
string —HTML string for the price display.
get_popular()
Get the popular state for the bundle
public
get_popular() : bool
Return values
bool —get_popular_label()
Get the popular label for the bundle
public
get_popular_label() : string
Return values
string —get_product()
Get the product.
public
get_product() : WC_Product
Return values
WC_Product —get_quantity()
Get the product quantity
public
get_quantity() : int
Return values
int —get_tier_prices()
Calculate original and final prices for this tier based on the total original price.
public
get_tier_prices(float $total_original_price) : array<string|int, mixed>
Parameters
- $total_original_price : float
-
The total price before any bundle discount (base_price * quantity).
Return values
array<string|int, mixed> —Associative array with 'original_total' and 'final_total'.