Cherry pick 50685 into release/9.2 (#50705)
* Remove global_unique_id from interface and add warning in case it is not implemented (#50685) * Prep for cherry pick 50685 * Cherry-pick 50702 into this cherry-pick :) * Update changelog --------- Co-authored-by: Nathan Silveira <nsschneider1@gmail.com> Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com> Co-authored-by: Jorge Torres <jorge.torres@automattic.com>
This commit is contained in:
parent
7650d408df
commit
8039a96735
|
@ -41,15 +41,6 @@ interface WC_Product_Data_Store_Interface {
|
||||||
*/
|
*/
|
||||||
public function is_existing_sku( $product_id, $sku );
|
public function is_existing_sku( $product_id, $sku );
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if product unique ID is found for any other product IDs.
|
|
||||||
*
|
|
||||||
* @param int $product_id Product ID.
|
|
||||||
* @param string $global_unique_id Unique ID.
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function is_existing_global_unique_id( $product_id, $global_unique_id );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return product ID based on SKU.
|
* Return product ID based on SKU.
|
||||||
*
|
*
|
||||||
|
@ -58,13 +49,6 @@ interface WC_Product_Data_Store_Interface {
|
||||||
*/
|
*/
|
||||||
public function get_product_id_by_sku( $sku );
|
public function get_product_id_by_sku( $sku );
|
||||||
|
|
||||||
/**
|
|
||||||
* Return product ID based on Unique ID.
|
|
||||||
*
|
|
||||||
* @param string $global_unique_id Unique ID.
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function get_product_id_by_global_unique_id( $global_unique_id );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of IDs of products that have sales starting soon.
|
* Returns an array of IDs of products that have sales starting soon.
|
||||||
|
|
|
@ -662,8 +662,13 @@ function wc_product_has_global_unique_id( $product_id, $global_unique_id ) {
|
||||||
return boolval( $has_global_unique_id );
|
return boolval( $has_global_unique_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
$data_store = WC_Data_Store::load( 'product' );
|
$data_store = WC_Data_Store::load( 'product' );
|
||||||
$global_unique_id_found = $data_store->is_existing_global_unique_id( $product_id, $global_unique_id );
|
if ( $data_store->has_callable( 'is_existing_global_unique_id' ) ) {
|
||||||
|
$global_unique_id_found = $data_store->is_existing_global_unique_id( $product_id, $global_unique_id );
|
||||||
|
} else {
|
||||||
|
$logger = wc_get_logger();
|
||||||
|
$logger->error( 'The method is_existing_global_unique_id is not implemented in the data store.', array( 'source' => 'wc_product_has_global_unique_id' ) );
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Gives plugins an opportunity to verify Unique ID uniqueness themselves.
|
* Gives plugins an opportunity to verify Unique ID uniqueness themselves.
|
||||||
*
|
*
|
||||||
|
@ -738,11 +743,17 @@ function wc_get_product_id_by_sku( $sku ) {
|
||||||
*
|
*
|
||||||
* @since 9.1.0
|
* @since 9.1.0
|
||||||
* @param string $global_unique_id Product Unique ID.
|
* @param string $global_unique_id Product Unique ID.
|
||||||
* @return int
|
* @return int|null
|
||||||
*/
|
*/
|
||||||
function wc_get_product_id_by_global_unique_id( $global_unique_id ) {
|
function wc_get_product_id_by_global_unique_id( $global_unique_id ) {
|
||||||
$data_store = WC_Data_Store::load( 'product' );
|
$data_store = WC_Data_Store::load( 'product' );
|
||||||
return $data_store->get_product_id_by_global_unique_id( $global_unique_id );
|
if ( $data_store->has_callable( 'get_product_id_by_global_unique_id' ) ) {
|
||||||
|
return $data_store->get_product_id_by_global_unique_id( $global_unique_id );
|
||||||
|
} else {
|
||||||
|
$logger = wc_get_logger();
|
||||||
|
$logger->error( 'The method get_product_id_by_global_unique_id is not implemented in the data store.', array( 'source' => 'wc_get_product_id_by_global_unique_id' ) );
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -173,6 +173,7 @@ WooCommerce comes with some sample data you can use to see how products look; im
|
||||||
|
|
||||||
**WooCommerce**
|
**WooCommerce**
|
||||||
|
|
||||||
|
* Fix - Remove global_unique_id from interface and add warning in case it is not implemented [#50685](https://github.com/woocommerce/woocommerce/pull/50685)
|
||||||
* Fix - CYS: avoid to enqueue Jetpack scripts [#50679](https://github.com/woocommerce/woocommerce/pull/50679)
|
* Fix - CYS: avoid to enqueue Jetpack scripts [#50679](https://github.com/woocommerce/woocommerce/pull/50679)
|
||||||
* Fix - Clear product unique ID (`global_unique_id`) when duplicating products. [#50629](https://github.com/woocommerce/woocommerce/pull/50629)
|
* Fix - Clear product unique ID (`global_unique_id`) when duplicating products. [#50629](https://github.com/woocommerce/woocommerce/pull/50629)
|
||||||
* Fix - Resolved an issue that caused the page title and content text to display in the incorrect order on the Order Confirmation page. [#50592](https://github.com/woocommerce/woocommerce/pull/50592)
|
* Fix - Resolved an issue that caused the page title and content text to display in the incorrect order on the Order Confirmation page. [#50592](https://github.com/woocommerce/woocommerce/pull/50592)
|
||||||
|
|
Loading…
Reference in New Issue