WC_Cart::find_product_in_cart( mixed $cart_id = false )
Check if product is in the cart and return cart item key.
Description Description
Cart item key will be unique based on the item and its properties, such as variations.
Parameters Parameters
- $cart_id
-
(Optional) id of product to find in the cart.
Default value: false
Return Return
(string) cart item key
Source Source
File: includes/class-wc-cart.php
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 ''; }