Like most Magento related issues, banging your head against the wall is often necessary to find a solution. This time however, nothing.
I am having a strange issue for customers who are logged out and trying to add items to an empty cart. It won't work for some specific product types.
I have extended the Cart Controller to add support for user inputted values instead of the standard Magento dropdown approach. This means that users could potentially input a number that doesn't yet exist yet as an associated product to my configurable (see image below).
Therefore I have implemented a system that will create the product should it not exist, then add it to the basket. This works beautifully for logged in users (and even logged out users with existing items in the basket). But it doesn't work when a logged out user has an empty cart despite it adding the success message.
My initial thought was that it was a Session related issue because users without accounts don't access the database, and also because it randomly starts working once a logged out user has items existing in the basket.
I have attempted refreshing sessions, initialising the cart, adding it twice for good measure but still nothing.