wc_get_product_id_by_global_unique_id()
Get product ID by Unique ID.
No Hooks.
Returns
Int|null.
Usage
wc_get_product_id_by_global_unique_id( $global_unique_id );
- $global_unique_id(string) (required)
- Product Unique ID.
Changelog
| Since 9.1.0 | Introduced. |
wc_get_product_id_by_global_unique_id() wc get product id by global unique id code WC 10.3.3
function wc_get_product_id_by_global_unique_id( $global_unique_id ) {
$data_store = WC_Data_Store::load( 'product' );
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;
}