WooCommerce Code Reference

ProductDescriptionUtils
in package

Product description utilities.

Table of Contents

$formatting_product_descriptions  : array<string|int, mixed>
Product IDs whose descriptions are currently being formatted.
guarded_format()  : string
Format an accessible product description while preventing same-product recursion.
is_description_accessible()  : bool
Whether the current visitor can access a product's description.

Properties

$formatting_product_descriptions

Product IDs whose descriptions are currently being formatted.

private static array<string|int, mixed> $formatting_product_descriptions = array()

Methods

guarded_format()

Format an accessible product description while preventing same-product recursion.

public static guarded_format(WC_Product $product, callable $format_callback) : string
Parameters
$product : WC_Product

Product object.

$format_callback : callable

Callback that formats the product description.

Return values
string — Formatted product description.