Display implements Registerable, Service

This class handles the display of lead times in the stock / availability area.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable
An object that can be registered with WordPress via the Plugin API, i.e. add_action() and add_filter().
Service
Marker interface to denote a service.

Table of Contents

get_lead_time()  : string
Get the global or individual lead time for the product.
get_lead_time_format_raw()  : string
Get the lead time format based on the product status details.
get_lead_time_raw()  : string|array<string|int, mixed>
Get the global or individual lead time for the product.
maybe_add_lead_time_availability_text()  : string
Display lead time inside availability.
maybe_add_lead_time_stock_html()  : string
Display lead time if conditions are met
maybe_add_lead_time_to_shop_pages()  : void
Display the stock with lead time on the product pages.
register()  : void
Register hooks and filters.

Methods

get_lead_time()

Get the global or individual lead time for the product.

public static get_lead_time(WC_Product $product) : string
Parameters
$product : WC_Product
Return values
string

get_lead_time_format_raw()

Get the lead time format based on the product status details.

public static get_lead_time_format_raw(WC_Product $product) : string

Check if the product is a variation and that the details are filled in. If details are missing then we fallback to the parent product.

Parameters
$product : WC_Product
Return values
string

get_lead_time_raw()

Get the global or individual lead time for the product.

public static get_lead_time_raw(WC_Product $product) : string|array<string|int, mixed>

If the format is dynamic, the date is returned as timestamp.

If the lead time is retrieved from the category and the format is "dynamic". It will return an array instead of a string.

Parameters
$product : WC_Product
Return values
string|array<string|int, mixed>

maybe_add_lead_time_availability_text()

Display lead time inside availability.

public maybe_add_lead_time_availability_text(string $availability, WC_Product $product) : string
Parameters
$availability : string
$product : WC_Product
Return values
string

$availability

maybe_add_lead_time_stock_html()

Display lead time if conditions are met

public maybe_add_lead_time_stock_html(string $html, WC_Product $product) : string
Parameters
$html : string
$product : WC_Product
Tags
since
1.0.0
Return values
string

$html

maybe_add_lead_time_to_shop_pages()

Display the stock with lead time on the product pages.

public maybe_add_lead_time_to_shop_pages() : void
Return values
void

register()

Register hooks and filters.

public register() : void
Return values
void

Search results