Automattic\WooCommerce\StoreApi\Utilities
CartController::get_variation_id()
For a given product, get the variation ID.
Method of the class: CartController{}
No Hooks.
Return
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 9.3.3
protected function get_variation_id( \WC_Product $product ) { return $product->is_type( 'variation' ) ? $product->get_id() : 0; }