Adjusting function to take a param, adding fix for no checkout page