Add_To_Cart implements Registerable, Standard_Service

Add to Cart Handler

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable
Standard_Service

Table of Contents

add_to_cart_message_html()  : string
Filter the add to cart message to include the additional products from all the Products option type fields.
handle_validation()  : bool
Handles validation on add to cart.
loop_add_to_cart_text()  : string
Add to cart text.
loop_add_to_cart_url()  : string
Add to cart URL.
loop_ajax_add_to_cart_support()  : bool
Remove AJAX add to cart support if the product has options.
register()  : void
{@inheritdoc}

Methods

add_to_cart_message_html()

Filter the add to cart message to include the additional products from all the Products option type fields.

public add_to_cart_message_html(string $message, array<string|int, mixed> $products, bool $show_qty) : string
Parameters
$message : string
$products : array<string|int, mixed>
$show_qty : bool
Tags
Return values
string

handle_validation()

Handles validation on add to cart.

public handle_validation(bool $passed, int $product_id, int $quantity[, int|null $variation_id = null ][, WC_Product_Variation $variation = null ]) : bool
Parameters
$passed : bool
$product_id : int
$quantity : int
$variation_id : int|null = null
$variation : WC_Product_Variation = null
Tags
Return values
bool

$passed

loop_add_to_cart_text()

Add to cart text.

public loop_add_to_cart_text(string $text, WC_Product $product) : string
Parameters
$text : string

Text.

$product : WC_Product

Product.

Tags
Return values
string

loop_add_to_cart_url()

Add to cart URL.

public loop_add_to_cart_url(string $url, WC_Product $product) : string
Parameters
$url : string

URL.

$product : WC_Product

Product.

Tags
Return values
string

loop_ajax_add_to_cart_support()

Remove AJAX add to cart support if the product has options.

public loop_ajax_add_to_cart_support(bool $supported, string $feature, WC_Product $product) : bool
Parameters
$supported : bool
$feature : string
$product : WC_Product
Tags
Return values
bool

register()

{@inheritdoc}

public register() : void
Tags
Return values
void

Search results