Automattic\WooCommerce\StoreApi\Utilities
CartController::get_variation_id
For a given product, get the variation ID.
Method of the class: CartController{}
No Hooks.
Returns
Int.
Usage
// protected - for code of main (parent) or child class $result = $this->get_variation_id( $product );
- $product(WC_Product) (required)
- Product object associated with the cart item.
CartController::get_variation_id() CartController::get variation id code WC 10.7.0
protected function get_variation_id( \WC_Product $product ) {
return $product->is_type( ProductType::VARIATION ) ? $product->get_id() : 0;
}