find_product_in_cart tweak Closes #3863

This commit is contained in:
Mike Jolley 2013-10-04 12:30:07 +01:00
parent 1b91c75039
commit b7a752ecc1
1 changed files with 4 additions and 3 deletions

View File

@ -805,9 +805,10 @@ class WC_Cart {
*/
public function find_product_in_cart( $cart_id = false ) {
if ( $cart_id !== false )
foreach ( $this->cart_contents as $cart_item_key => $cart_item )
if ( $cart_item_key == $cart_id )
return $cart_item_key;
if( is_array( $this->cart_contents ) )
foreach ( $this->cart_contents as $cart_item_key => $cart_item )
if ( $cart_item_key == $cart_id )
return $cart_item_key;
}
/**