WooCommerce – How to offer a free product with the purchase of certain products

Let’s say you running an offer where you want to give away a free product when a certain product or set of products is added to the cart.

Given how flexible and customizable WooCommerce is, everything is possible. Let’s see how we can accomplish this task.

PHP
functions.php

You need to add this code to the functions.php of your active theme. And you need to change the value of two variables: $products_should_be_in_cart variable and $free_products.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Up Next:

WooCommerce - How to calculate sum of all the sales ever done on the store?

WooCommerce - How to calculate sum of all the sales ever done on the store?