5

Assume my store sells unique items, like antiques. By definition, stock for each article is only one item. When a buyer adds such an item to their cart, store prevents them from adding more than one item to the cart, but does not reduce the stock (not until the item is sold) and does not prevent the add-to-cart button from being pushed again.

I would like to have a way to hide the button for this user while the item is in their cart, AND give some indication that a single item cannot be added more than once, even though the item is still in stock until it is sold. This is only needed in relation to the local terminal holding the item in the cart.

Is there a way to do this, natively or by whatever means?

2 Answers 2

3

It sounds like what you need to do is test how many of that particular SKU are currently in the customer's cart.

It's not possible to do this using native tags, however there is an extension on Devot:ee which appears to let you create conditionals on whether a product is currently in your cart:

See: Store: In_Cart Conditionals

UPDATE: As of Store 1.6.2 there is a {qty_in_cart} variable which allows you to do this on a per-entry basis (though not if your entries contain multiple SKUs).

{exp:store:product entry_id="{entry_id}"}
    {qty_in_cart}
{/exp:store:product}
1
  • thanks for the link. I have decided to write my own add-on. Commented Nov 24, 2012 at 21:32
0

I'm trying to get this to work as well but not having any luck. Say I just used the following snippit of code

{store:entry_id_in_cart:{entry_id}

If the item is in the cart the output should be:

1

Is that correct?

Currently it just outputs the string "{store:entry_id_in_cart:{entry_id}" which makes me think that either I'm not using the code properly or I haven't installed the extension properly.

Thanks

1
  • {store:entry_id_in_cart} doesn't appear to be a standard tag. I believe it belongs to this plugin. Also, as the variable would generally be written as {store:entry_id_in_cart:data}, I think then {store:entry_id_in_cart:{entry_id}} makes more sense. A very similar thread resides here
    – Holland
    Commented Dec 13, 2012 at 13:26

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.