created a function that does the validation on the cart pages, before adding to cart