Adding to cart shows “there are no products in your shopping cart” unless a logged in uesr

Products are not adding to cart after we migrated the drupal 7, unless if you are not logged in user. So after spending some time in reasearch I got this solved.

Problem –

Unless you are not a logged in to user the products are not adding to cart

Possible solutions

  1. Try checking your “users” table in the database and see if the anonymous user uid is SET to zero, if not then make it zero . If you are not seeing any records without name and details add one new row to table as per the followsFor Drupal 7
    INSERT INTO users (name, pass, mail, theme, signature, language, init, timezone) VALUES ('', '', '', '', '', '', '', ''); 
    UPDATE users SET uid = 0 WHERE name = '';
    This will insert a new row getting a random UID and then the update query fixes to get the right uid for the user.
  2. Another solution try to clear the session table
Editorial Staff

Editorial Staff at tutsplanet is a dedicated team to write various tutorial articles.