Product_Cart extends Abstract_Product_Data
Gets data for the add to cart column.
Tags
Table of Contents
- MULTI_CART_FORM_ID = 'multi-cart'
- $links : mixed
- $parent_product : mixed
- $product : mixed
- $cart_button : mixed
- $default_quantity : mixed
- $multi_cart : mixed
- $quantities : mixed
- $variations : mixed
- __construct() : mixed
- Constructor.
- get_data() : string
- Get the data for the Buy column for this product.
- get_filter_data() : mixed
- get_product_price() : mixed
- get_sort_data() : mixed
- ignore_posted_quantity() : array<string|int, mixed>
- WooCommerce sets the quantity input_value based on the posted quantity, and if not set, uses get_min_purchase_quantity.
- store_product_default_quantity() : array<string|int, mixed>
- Store the default quantity for this product based on the input value set in woocommerce_quantity_input.
- format_term_data() : mixed
- get_parent_product() : mixed
- get_parent_product_id() : mixed
- get_product_attribute() : mixed
- get_product_id() : mixed
- get_product_taxonomy_terms() : mixed
- get_separator() : mixed
- maybe_strip_shortcodes() : mixed
- add_multi_cart_hidden_fields() : void
- Add hidden fields to the add to cart form for the checkbox (multi) add method.
- get_add_to_cart_class() : string
- Get the add to cart class - used to wrap the entire data in the Buy cell.
Constants
MULTI_CART_FORM_ID
public
mixed
MULTI_CART_FORM_ID
= 'multi-cart'
Properties
$links
protected
mixed
$links
$parent_product
protected
mixed
$parent_product
$product
protected
mixed
$product
$cart_button
private
mixed
$cart_button
$default_quantity
private
mixed
$default_quantity
= 1
$multi_cart
private
mixed
$multi_cart
$quantities
private
mixed
$quantities
$variations
private
mixed
$variations
Methods
__construct()
Constructor.
public
__construct(WC_Product $product[, bool|string $variations = false ][, bool $quantities = false ][, string $cart_button = 'button' ][, bool $multi_cart = false ]) : mixed
Parameters
- $product : WC_Product
-
The product object.
- $variations : bool|string = false
-
The variations arg.
- $quantities : bool = false
-
Whether to show quantities.
- $cart_button : string = 'button'
-
The cart button arg.
- $multi_cart : bool = false
-
Whether to use the multi cart (checkboxes).
Return values
mixed —get_data()
Get the data for the Buy column for this product.
public
get_data() : string
Return values
string —The HTML for the buy column.
get_filter_data()
public
get_filter_data() : mixed
Return values
mixed —get_product_price()
public
get_product_price() : mixed
Return values
mixed —get_sort_data()
public
get_sort_data() : mixed
Return values
mixed —ignore_posted_quantity()
WooCommerce sets the quantity input_value based on the posted quantity, and if not set, uses get_min_purchase_quantity.
public
ignore_posted_quantity(array<string|int, mixed> $args, WC_Product $product) : array<string|int, mixed>
When ajax_cart is disabled, we don't want to show the posted quantity as this means all products in the table show the quantity for the previous product added to the cart. This filter runs early so any quantity plugins running can update as needed.
Parameters
- $args : array<string|int, mixed>
- $product : WC_Product
Tags
Return values
array<string|int, mixed> —store_product_default_quantity()
Store the default quantity for this product based on the input value set in woocommerce_quantity_input.
public
store_product_default_quantity(array<string|int, mixed> $quantity_args, WC_Product $product) : array<string|int, mixed>
Parameters
- $quantity_args : array<string|int, mixed>
- $product : WC_Product
Return values
array<string|int, mixed> —format_term_data()
protected
static format_term_data(WP_Term $term[, mixed $show_links = false ][, mixed $column = null ]) : mixed
Parameters
- $term : WP_Term
- $show_links : mixed = false
- $column : mixed = null
Return values
mixed —get_parent_product()
protected
get_parent_product() : mixed
Return values
mixed —get_parent_product_id()
protected
get_parent_product_id() : mixed
Return values
mixed —get_product_attribute()
protected
static get_product_attribute(mixed $attribute, mixed $attributes) : mixed
Parameters
- $attribute : mixed
- $attributes : mixed
Return values
mixed —get_product_id()
protected
get_product_id() : mixed
Return values
mixed —get_product_taxonomy_terms()
protected
get_product_taxonomy_terms(mixed $column) : mixed
Parameters
- $column : mixed
Return values
mixed —get_separator()
protected
static get_separator(mixed $item_type) : mixed
Parameters
- $item_type : mixed
Return values
mixed —maybe_strip_shortcodes()
protected
static maybe_strip_shortcodes(mixed $text[, mixed $process_shortcodes = false ]) : mixed
Parameters
- $text : mixed
- $process_shortcodes : mixed = false
Return values
mixed —add_multi_cart_hidden_fields()
Add hidden fields to the add to cart form for the checkbox (multi) add method.
private
add_multi_cart_hidden_fields() : void
Return values
void —get_add_to_cart_class()
Get the add to cart class - used to wrap the entire data in the Buy cell.
private
get_add_to_cart_class() : string
Return values
string —The add to cart CSS class.