I am running EE 2.7.3 and Cartthrob 2.4

Trying to use this tag

{exp:cartthrob:is_in_cart entry_id="1234"}

But not matter what entry_id I use the tag always returns true (1 actually)

The only way I can get to return false (0) is to leave the entry_id param blank

I could be missing something but I think this is a bug?


I set up a minimal test case with this being the only template code

{exp:cartthrob:is_in_cart entry_id="XXXX"}

I put 3 items in the cart entry_id 3517 entry_id 3518 on the fly dynamic item with no entry id

passing 'XXXX' to the tag is not a valid entry ID, but the tag still returns 1

if the cart is empty the tag returns 0 as expected

if I remove the on the fly product the tag returns 0 as expected

sounds like the issue has to do with on the fly products, does that help at all with troubleshooting?

  • I tested that tag with EE 2.7.3 and CT 2.4, but can't seem to replicate the problem you're having. Can you provide some more info that might help me recreate the issue? Does it always return true even with an empty cart? Are you using on the fly products? Are you using any kind of plugin that automatically adds an item to the cart? Jan 22, 2014 at 22:45
  • Curious. I updated the question above with some more info. Let me know what else you'd like to know.
    – mjr
    Jan 23, 2014 at 14:40
  • Looks like you can replicate the behavior by adding an on the fly product to the cart.
    – mjr
    Jan 23, 2014 at 14:45
  • Just want to verify this is not the expected behavior of this tag. On the fly items shouldn't effect items with an entry_id, is that right?
    – mjr
    Jan 29, 2014 at 14:40

1 Answer 1


There's a bug in CartThrob core files causing this. It's been corrected for the next release. You can go to:

cartthrob > cartthrob > core > Cartthrob_cart.php


    public function find_item(array $data)

    return current($this->filter_items($data));

replace with:

    public function find_item(array $data)
    $filtered_items = $this->filter_items($data); 
    if (!empty($filtered_items) && count($filtered_items) >0)
        return current($filtered_items);
    return FALSE;

That should fix it for you until the next release comes out with that fix included.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.