WC_Cart::find_product_in_cart()
Check if product is in the cart and return cart item key.
Cart item key will be unique based on the item and its properties, such as variations.
Метод класса: WC_Cart{}
Хуков нет.
Возвращает
Строку
. cart item key
Использование
$WC_Cart = new WC_Cart(); $WC_Cart->find_product_in_cart( $cart_id );
- $cart_id(разное)
- id of product to find in the cart.
По умолчанию: false
Код WC_Cart::find_product_in_cart() WC Cart::find product in cart WC 9.3.3
public function find_product_in_cart( $cart_id = false ) { if ( false !== $cart_id ) { if ( is_array( $this->cart_contents ) && isset( $this->cart_contents[ $cart_id ] ) ) { return $cart_id; } } return ''; }