plugin updates

This commit is contained in:
Tony Volpe
2024-09-05 11:04:01 -04:00
parent ed6b060261
commit 50cd64dd3d
925 changed files with 16918 additions and 13003 deletions

View File

@@ -405,6 +405,7 @@ class WC_Post_Data {
$data_store->untrash_variations( $id );
wc_product_force_unique_sku( $id );
self::clear_global_unique_id_if_necessary( $id );
wc_get_container()->get( ProductAttributesLookupDataStore::class )->on_product_changed( $id );
} elseif ( 'product_variation' === $post_type ) {
@@ -412,6 +413,19 @@ class WC_Post_Data {
}
}
/**
* Clear global unique id if it's not unique.
*
* @param mixed $id Post ID.
*/
private static function clear_global_unique_id_if_necessary( $id ) {
$product = wc_get_product( $id );
if ( $product && ! wc_product_has_global_unique_id( $id, $product->get_global_unique_id() ) ) {
$product->set_global_unique_id( '' );
$product->save();
}
}
/**
* Get the post type for a given post.
*