add_to_cart how to call it woocommerce

To call the add_to_cart function in WooCommerce, you can use the following code:

add_to_cart(product_id, quantity);

Replace product_id with the ID of the product you want to add to the cart, and quantity with the desired quantity of that product. This function is typically used to programmatically add products to the WooCommerce cart.

Please note that this code assumes you have already included the necessary WooCommerce files and initialized the WooCommerce environment in your C program.