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 7.5.1
protected function get_variation_id( \WC_Product $product ) { return $product->is_type( 'variation' ) ? $product->get_id() : 0; }