Automattic\WooCommerce\Internal\Caches
ProductTransientsDeferrer::maybe_defer_deletion
Record a product ID for deferred transient deletion, if deferral is active.
Method of the class: ProductTransientsDeferrer{}
No Hooks.
Returns
true|false. True if the deletion was deferred, false if deferral is not active.
Usage
$ProductTransientsDeferrer = new ProductTransientsDeferrer(); $ProductTransientsDeferrer->maybe_defer_deletion( $product_id ): bool;
- $product_id(int) (required)
- Product ID whose transients were requested to be deleted.
ProductTransientsDeferrer::maybe_defer_deletion() ProductTransientsDeferrer::maybe defer deletion code WC 11.0.0
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;
}