Home » Ecommerce » Code School: Woo Shipping Per Product Count Script

Code School: Woo Shipping Per Product Count Script

Here’s a little snippet that has been useful for woocommerce development. This regulates shipping charges from a simple fee based system to a fee per quantity output. We modified this to allow for a couple of different shipping charge options based on quantity – first by three’s and then free shipping if over 9 are purchased.

cart->get_cart_contents_count();

// if we have items that need shipping, round the quantity / 2 to the nearest whole number

// this produces tiered cost increases for every 2 items

if ( $cart_item_count > 1 ) {

$cost = ceil( $cart_item_count / 3 ) * $cost;

}
return $cost;

}

add_filter( ‘woocommerce_shipping_rate_cost’, ‘njengah_wc_shipping_cost_tiers’, 10, 2 );

More Web Design Blog Content

Using Zapier and ChatGPT

Here are some powerful and practical Zapier + ChatGPT workflow ideas across a variety of use cases — ideal for small businesses looking to automate content creation, customer service, and lead handling: ✉️ 1. Auto-Reply to Form Submissions with Personalized Emails Trigger: New form submission via Webflow, Typeform,

Netgear Routers Are Terrible

Why did we purchase this product for our office? What a mistake. Range on this router is about 4 feet before the signal drops off significantly. Speeds are sketchy and we experienced significant slowdown periods throughout the day. Connections lost – impromptu port disabling, you name it. If there

Even More Internet Marketing Success

We’ve been working with attorneys all over town. None more than Fisher, Butts, Sechrest and Warner. They’re great folks located over in Haile. They have a successful law firm and are enjoying much success online. When we met, they were basically nowhere online … maybe somewhere back on

Preloading Images with Jquery

There are times when preloading images is an important step in keeping your site/page/program running smoothly. This is especially true in the era of mobile. Here’s a cute little snippet that does just that. function preload(yourarrayOfImages) { $(yourarrayOfImages).each(function(){ $(‘<img/>’)[0].src = this; }); } preload([ ‘img/image1.jpg’, ‘img/image2.jpg’, ‘img/image3.jpg’ ]);

WordPress Custom Post Type Category Images : Solved

If you’re a WordPress developer, you’ve probably been here. You want to use images for your categories, but they are custom taxonomies. Here’s how to solve that issue. We’re using a plugin called “Category Images” by Muhammad Said El Zahlan. Download, install and activate the plugin. Now you can

To Gimp or Not To Gimp

In the world of photo editing, adobe photoshop is king. They really do have an amazing product. It’s sleek, works great, and is very robust sporting dozens and dozens of functions and endless possibilities for the graphic artist.  Photoshop is also very, very expensive. The entire Adobe creative