Show/Hide Free Shipping Based on Item Count for Domestic Shipment

One of our customers John was creating a comic book e-commerce site and wanted to setup free shipping within Australia only for customers who buy 12 or more comic books.

We created a code snippet as below that enables to show/hide Free Shipping based on item count for domestic shipment:

In the above code, alter the number in the variable ($minimum_number_of_item = 12;) to change the number of items you want to be in the cart to offer free shipping.

Also alter the variable for country code ($shop_country = ‘AU’;) as applicable.

Here are two screenshots to show how the snippet works:

Screenshot 1: Cart with less than 12 items

Screenshot 2: Cart with more than 12 items

Leave a Reply