Automattic\WooCommerce\StoreApi\Utilities
CartController::get_variation_id
For a given product, get the variation ID.
Метод класса: CartController{}
Хуков нет.
Возвращает
int.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_variation_id( $product );
- $product(WC_Product) (обязательный)
- Product object associated with the cart item.
Код CartController::get_variation_id() CartController::get variation id WC 11.0.1
protected function get_variation_id( \WC_Product $product ) {
return $product->is_type( ProductType::VARIATION ) ? $product->get_id() : 0;
}