Sometimes you would like to have a default product show up in your customer’s cart. For example, that is a freegift product or just a product you would like to sell.
For doing that, you can use my small script bellow. Remember to put it before the closed body tag and change the ID of variant product to valid ID. You can choose auto reloading page after product has been added or redirecting it to specified page (cart page) if you want.