Set cookies when using AJAX add to cart

This change ensures that cookies are set when non logged in user tries to add a product to cart using AJAX. Resolves #6244.