How to programatically add a product to the cart using a function?