diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index 2e8aedbb532..36b70c5fc5a 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -708,6 +708,19 @@ class WC_Cart { return $cart_session; } + /** + * Returns a specific itme in the cart + * + * @return array item data + */ + public function get_cart_item( $item_key ) { + if ( isset( $this->cart_contents[ $item_key ] ) ) { + return $this->cart_contents[ $item_key ]; + } + + return false; + } + /** * Returns the cart and shipping taxes, merged. *