add to purchase function