Product_Table implements Registerable
Integrates with Product Table.
Tags
Interfaces, Classes and Traits
- Registerable
Table of Contents
- $processing_bundle : bool
- Flag to prevent recursive bundle processing.
- enqueue_wpt_integration_script() : void
- Enqueue the WPT integration script on pages with product tables.
- handle_bundle_add_to_cart() : void
- Handle bundle add-to-cart for WPT.
- handle_bundle_cart_submission() : void
- Handle bundle cart submissions on wp_loaded.
- register() : mixed
- remove_discount_content_in_buy_col() : string
- Remove the discount content in the buy column.
- render_discount_column() : string
- Render the discount column.
- set_default_column_name() : array<string|int, mixed>
- Set the default column name for the discount column.
- remove_div_with_class() : string
- Remove div elements with a specific class while maintaining HTML structure.
Properties
$processing_bundle
Flag to prevent recursive bundle processing.
private
bool
$processing_bundle
= false
Methods
enqueue_wpt_integration_script()
Enqueue the WPT integration script on pages with product tables.
public
enqueue_wpt_integration_script() : void
Return values
void —handle_bundle_add_to_cart()
Handle bundle add-to-cart for WPT.
public
handle_bundle_add_to_cart(WC_Product $product, int $quantity, int $variation_id, array<string|int, mixed> $variations) : void
Parameters
- $product : WC_Product
-
The product object.
- $quantity : int
-
The quantity.
- $variation_id : int
-
The variation ID.
- $variations : array<string|int, mixed>
-
The variations.
Return values
void —handle_bundle_cart_submission()
Handle bundle cart submissions on wp_loaded.
public
handle_bundle_cart_submission() : void
Return values
void —register()
public
register() : mixed
Tags
Return values
mixed —remove_discount_content_in_buy_col()
Remove the discount content in the buy column.
public
remove_discount_content_in_buy_col(string $data, WC_Product $product) : string
Parameters
- $data : string
-
The column data.
- $product : WC_Product
-
The product.
Return values
string —The column data.
render_discount_column()
Render the discount column.
public
render_discount_column(string $data, WC_Product $product, array<string|int, mixed> $args) : string
Parameters
- $data : string
-
The column data.
- $product : WC_Product
-
The product.
- $args : array<string|int, mixed>
-
The column args.
Return values
string —The column data.
set_default_column_name()
Set the default column name for the discount column.
public
set_default_column_name(array<string|int, mixed> $defaults) : array<string|int, mixed>
The default column name is "Discount". This is the column name that will be used if the user does not change it. The priority of the column is set to the highest priority of the other columns + 1.
Parameters
- $defaults : array<string|int, mixed>
-
The default columns.
Return values
array<string|int, mixed> —The default columns.
remove_div_with_class()
Remove div elements with a specific class while maintaining HTML structure.
private
remove_div_with_class(string $html, string $class_name) : string
This method properly handles nested divs by counting opening and closing tags.
Parameters
- $html : string
-
The HTML content.
- $class_name : string
-
The class name to search for.
Return values
string —The HTML content with the specified div removed.