WordPress at Your Fingertips
function is not described

WC_Product_Data_Store_CPT::clear_caches() protected WC 3.0.0

Clear any caches.

{} It's a method of the class: WC_Product_Data_Store_CPT{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->clear_caches( $product );
$product(WC_Product) (required) (passed by reference — &)
Product object.

Changelog

Since 3.0.0 Introduced.

Code of WC_Product_Data_Store_CPT::clear_caches() WC 5.8.0

protected function clear_caches( &$product ) {
	wc_delete_product_transients( $product->get_id() );
	if ( $product->get_parent_id( 'edit' ) ) {
		wc_delete_product_transients( $product->get_parent_id( 'edit' ) );
		WC_Cache_Helper::invalidate_cache_group( 'product_' . $product->get_parent_id( 'edit' ) );
	}
	WC_Cache_Helper::invalidate_attribute_count( array_keys( $product->get_attributes() ) );
	WC_Cache_Helper::invalidate_cache_group( 'product_' . $product->get_id() );
}