WooCommerce Add a product to the cart programmatically

At times you may want to give free gift when customer purchase specific product from your shop. Instead of user need to select the gift explicitly you would like to add it automatically to the cart, when user add given product to the cart.

Below code snippet will help you to achieve exactly that. In this PHP code you can select which product to add to the cart and quantity of that product as well.

Continue reading →

How to display Woocommerce Cart Widget on any page

By default WooCommerce provide facility to add WooCommerce Cart Widget to the Widget Areas defined by your theme.

But sometimes you may want to display Cart widget on some specific part of the page directly and not just on sidebar.

You can use following PHP statement to display WooCommerce cart widget anywhere on your site.
Continue reading →