Adding a Fee in Woocommerce

This piggybacks off of a solution I found elsewhere. We modified it to add a single fee for products based on the taxonomy. It comes in handy to categories products and then apply this rule to that category.

function action_woocommerce_checkout_calculate_fees( $cart ) {

// Initialize
$quantity = 0;
$hasfee = 0;
$fee = 0;
// Loop though each cart item
foreach ( $cart->get_cart() as $cart_item ) {
// Compare
$quantity = 0;
$product_id = $cart_item[‘product_id’];
$quantity = $cart_item[‘quantity’];
$taxonomy = ‘product_tag’;
if( has_term( ‘Embroidery’, $taxonomy, $product_id ) ){
if( !has_term( ‘NOE’, $taxonomy, $product_id ) ){
// Addition
// Get product quantity in cart
$hasfee = 1;
$fee = $fee + (4.99 * $quantity);
}
}
}
if($hasfee == 1){
$cart->add_fee( __( ‘Embroidery Fee’, ‘woocommerce’ ), $fee );
}

}
add_action( ‘woocommerce_cart_calculate_fees’, ‘action_woocommerce_checkout_calculate_fees’, 10, 1 );

 

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

Maintaining Correct Site Structure

One of the biggest holes in a client’s SEO (pre livewire SEO, that is) is almost always the site structure. So many SEO companies focus on content and backlinks that quality code is often overlooked. There are many cases where we have come into the tail end of

Eat More Protien

Meat in your website diet is needed – you’re probably in optimization atrophy … What is meat for your website? Content. Your site need fresh content added to it on a regular basis. Good content. Compelling content. But most of all, it need to be original content. That means

Branding & Marketing Services

Livewire is proud to announce that we are now offering professional branding and marketing services. Phil, the owner, never considered branding services because, well to be honest, he is terrible at graphic design (he’s a programmer so it’s okay). Branding services include but are not limited to : Branding

Woocommerce Products Per Page

Interestingly Woocommerce does not seem to have a default setting for ‘products per page’. Unsurprisingly, there’s a simple workaround. Add to your functions.php Replace “28” with whatever number you want. add_filter( ‘loop_shop_per_page’, create_function( ‘$cols’, ‘return 28;’ ), 20 );

Gatorland Kubota Has A New Website

A great new site for a great company with new ownership. Gatorland Kubota sells and services all kinds of farm and lawn equipment. A family owned and operated business there is no doubt that they want the best for their customers. After all, they chose livewire didn’t they?