Fixing JS error on purchase page