popcornkirby
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce Product Fees] I want to always have the same fee per productHi Eric,
I used the above function and it works. The only problem is that any coupons and shipping calculations don’t include this added fee. If a customer used a 100% off discount coupon, for example, the cart would go to $0 but the added fee would still be there.
Do you have any idea how we can modify the code?
Thanks a lot!
KirbyForum: Plugins
In reply to: [WooCommerce] Adding fee based on the cart totalHi Mike,
We used the above code in a similar fashion and was able to get it taxable. Do you have any idea how we could get the coupon and shipping calculations to include this added fee as well? For example, with the above code, if we apply a 100% off coupon to the cart the added fee is still there but we want it to go to $0. The code I am working with is pasted below for reference.
Kirby
add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' ); function woo_add_cart_fee() { global $woocommerce; $qtytotal = 0; $cnt = 0; $curr_cost = 0; foreach ($woocommerce->cart->get_cart() as $item) { $qty = $item['quantity']; $cost = get_post_meta($item['product_id'], 'customer_wants_tea_bag', false); if (!empty($cost)) { $qtytotal = $qty + $qtytotal; $curr_cost = $cost[0]; } } $woocommerce->cart->add_fee( __('Packing', 'woocommerce'), $qtytotal * 6, TRUE); }
Forum: Plugins
In reply to: [WooCommerce] Checkout Coding – Fees Counting Towards SubtotalThanks for your reply.
All of our products are customized and created based on what ingredients the customer selects, so the plugins won’t work easily for us.
The above code actually works but the problem is that its added after the subtotal, coupon and shipping calculations. We want the coupon and shipping to reflect this added fee as well.
Would greatly appreciate any insights anyone can offer. Thank you!