Product_Cart extends Abstract_Product_Data

Gets data for the add to cart column.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

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_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'
Tags

Properties

$default_quantity

private mixed $default_quantity = 1
Tags

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).

Tags
Return values
mixed

get_data()

Get the data for the Buy column for this product.

public get_data() : string
Tags
Return values
string

The HTML for the buy column.

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
see

woocommerce/templates/single-product/add-to-cart/simple.php

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
Tags
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
Tags
Return values
mixed

get_parent_product_id()

protected get_parent_product_id() : mixed
Tags
Return values
mixed

get_product_attribute()

protected static get_product_attribute(mixed $attribute, mixed $attributes) : mixed
Parameters
$attribute : mixed
$attributes : mixed
Tags
Return values
mixed

get_product_taxonomy_terms()

protected get_product_taxonomy_terms(mixed $column) : mixed
Parameters
$column : mixed
Tags
Return values
mixed

get_separator()

protected static get_separator(mixed $item_type) : mixed
Parameters
$item_type : mixed
Tags
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
Tags
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
Tags
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
Tags
Return values
string

The add to cart CSS class.

Search results