Inventory and out of stock items

Permalink Browser Info Environment
Hello,

I'm familiar with FoxyCart, which I believe is very similar in idea to Snipcart, but I'm looking at switching to Snipcart and using this addon partly because of the inventory management capability that Snipcart has. However, I have some fairly specific hopes and dreams, and while I suspect I would be asking too much for your add-on to already incorporate these features, I'm wondering whether I might be able to build on what you've got and add the functionality I'm looking for. (Or hire a developer to help with this...) Can you tell me if the following would even be possible with how Snipcart and your addon work? If it's something I need to ask Snipcart instead, just let me know!

I will be selling unique products (only one of each item), and I would really prefer it if two customers weren't able to have the same product in their respective carts at the same time. Sort of like when you're buying tickets online and the seats you've selected are held for you for some amount of time, and then released if you don't go through with buying them. I'm not so much concerned with a specific time-frame, but I want to avoid the disappointment of someone thinking they can buy the item they want, and then finding out that someone has beat them to it by putting in their credit card number more quickly. I think what I understand from Snipcart's documentation is that an item becomes out of stock when someone completes a transaction to buy it, at which point anyone else who also has it in their cart gets a notification that the item is no longer available. Does this sound right?

What I would love instead is to do something like hide the add to cart button once the item is in someone's cart, so that no one else can put it in their cart unless it's released. Do you think this might be possible?

(In an even more ideal world, there would be some sort of "pending purchase" notification that then changes to "out of stock" once the item is actually bought, but this isn't totally necessary.)

Thanks for any thoughts you have on the subject!

Type: Pre-Sale
Status: Resolved
crispysmores
View Replies:
mesuva replied on at Permalink Reply
mesuva
Hi there,

I don't think it's possible with Snipcart to hide or change the Add To Cart button to others when someone puts that single item into their cart - the concrete5 site doesn't know _anything_ about the carts as that's all handled by Snipcart's scripts and servers.

It's actually quite a hard problem in general, as it means you have to have a shopping cart that stores the cart items in a database table, and do some stuff to ensure it gets eventually 'released' if an item isn't purchased. Community Store for example keeps the carts in a session, and not in a database, so even there there's not something that handles that.

I think it might be possible with Community Store with some extra code or an extra package, something that keeps a seperate tally of when things are added to carts - pretty fiddly though.

I'll mention that with Snipcart though, although two customers could put the same single product into their carts, there is a mechanism in place to stop the second transaction going through.

What happens is that when a transaction is put through, Snipcart calls back to the site to verify that the actual product existed (otherwise people could modify product details on page). That callback of the site outputs on a special URL the product block, but if that's sold out it won't display. So if Snipcart hits that, it prevents the transaction.

That message isn't particularly meaningful, it's more along the lines of 'Something went wrong', rather than what you'd probably want which is 'this product has just been purchased, sorry'.

This protection relies on the callback from Snipcart that updates stock levels from the first transaction to happen very quickly, which is does, but I think there might be a split second there where there's a chance that someone gets in in time. I think that's as good as it gets though with this setup.

You would be able to set this up in test mode on a publicly accessible site (transactions can't go through on private network), and test this scenario pretty easily, you'd just have to make sure you set up the callbacks, etc.

If you did want to do this, you could purchase it now and if it's simply not the mechanism you're looking for I'd be happy to issue a refund.

From what you've described though, I think you might need to build something custom - as I've mentioned Snipcart's carts aren't able to be interrogated by concrete5 in any way, it's a completely seperate connection between the customer and Snipcart.

-Ryan
ryan@mesuva.com.au

concrete5 Environment Information

# concrete5 Version
Core Version - 8.3.2
Version Installed - 8.3.2
Database Version - 20180122213656

# concrete5 Packages
Cloneamental (0.9.3)

# concrete5 Overrides
None

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
7.0.30

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, ionCube Loader, json, ldap, libxml, mbstring, mcrypt, memcached, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 120
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 120
max_input_vars - 3000
memory_limit - 768M
post_max_size - 128M
sql.safe_mode - Off
upload_max_filesize - 128M
ldap.max_links - Unlimited
memcached.sess_lock_max_wait - 0
mysqli.max_links - 60
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - 60
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
opcache.max_accelerated_files - 2000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.