Fix JS errors and PHP errors in add_to_cart function