Automattic\WooCommerce\Internal\Caches

ProductTransientsDeferrer::maybe_defer_deletion │ public │ WC 1.0

Record a product ID for deferred transient deletion, if deferral is active.

Метод класса: ProductTransientsDeferrer{}

Хуков нет.

Возвращает

bool. True if the deletion was deferred, false if deferral is not active.

Использование

$ProductTransientsDeferrer = new ProductTransientsDeferrer();
$ProductTransientsDeferrer->maybe_defer_deletion( $product_id ): bool;
$product_id(int) (обязательный)
Product ID whose transients were requested to be deleted.

Код ProductTransientsDeferrer::maybe_defer_deletion() WC 11.2.2

public function maybe_defer_deletion( int $product_id ): bool {
	if ( 0 === $this->deferral_level ) {
		return false;
	}

	$this->deferred_product_ids[ $product_id ] = true;
	return true;
}