WC_Product_Data_Store_CPT::clear_caches()
Clear any caches.
Method of the class: WC_Product_Data_Store_CPT{}
No Hooks.
Return
null
. Nothing (null).
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. |
WC_Product_Data_Store_CPT::clear_caches() WC Product Data Store CPT::clear caches code WC 9.4.2
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() ); }