get_id()
18th January 2021
0 Comments
Framework / CMS
WooCommerce [Version: Since 2.6.0]
Syntax
Typical Usage
Gets and returns the product ID for a given WooCommerce product.
Accepted Parameters
none
Return Value(s)
Returns the product ID as an integer.Examples of get_id()
Example 1
<?php
$product = wc_get_product($item);
$id = $product->get_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.