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

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’ ]);

New Website for NWSF!

Northwest Seafood got hacked unfortunately. Being previous clients of ours we came to the rescue. The site was damaged beyond repair so our team of Gainesville Web Design experts took hold and gave them a brand new website in a matter of days. We always support our clients in

What is Lorem Ipsum?

Lorem ipsum is simply Latin text. Gobbledygook, essentially. Well, not really; It does have its roots in latin text from just before the BC to BCE line, so that puts it around 2000 years old. Past that, it’s gibberish.  Sometimes web developers need filler text to create web

Gainesville Web Development

What a market. Gainesville has it all, especially its share of web developers. With new blood coming into the market – funnelled into and out of Gainesville via the University – our little town has an abundance of web developers looking to make a name for themselves. And we wish

Florida Auctioneers Has A New Website

Proud to present the new and improved Florida Auctioneers Association Website! This was a lengthy project but the final website is well worth it. Really more of a web portal, the system is chock full of features and runs smooth and fast. The site features: Membership program Member

The problems with Wix

Wix is a do-it-yourself website builder. While this may seem to be in direct competition with Gainesville Web Design companies, they fill an important niche; mainly, those customers that cannot afford a professional website but still desire to have a nice looking design for their business. The templates