WC_Cart::find_product_in_cart() public WC 1.0
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.
Код WC_Cart::find_product_in_cart() WC Cart::find product in cart WC 5.0.0
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 '';
}