wc_get_product_id_by_sku()
18th January 2021
0 Comments
Framework / CMS
WooCommerce [Version: Since 2.3.0]
Syntax
Typical Usage
Gets the ID of a product using the SKU.
Accepted Parameters
sku (string) (Required): The product SKU required for the lookup.
Return Value(s)
Returns the product ID as an integer.Examples wc_get_product_id_by_sku()
Example 1
<?php
$id = wc_get_product_id_by_sku(1234);
$product = wc_get_product($id)
Used In Projects
Was This Helpful?
If this post has helped you, please let me know. Your feedback will be highly appreciated and will help me build better content.