fee

WooCommerce minimum order fee for products in specific category

时光总嘲笑我的痴心妄想 提交于 2020-07-03 05:27:25
问题 I want to add a fee in my woocommerce store for orders under a specific amount (value, not quantity). I am using "WooCommerce dynamic minimum order amount based fee" answer code that works perfectly. Now I am trying to change this functionand to apply it only to items from a specific product category. Basically, I have to sum the value of all the products in cart that matches the specific category and use this value for fee calculation. How can I reach this goal? 回答1: The following revisited

Additional price based on cart item count in WooCommerce

99封情书 提交于 2020-02-06 04:11:52
问题 Based on "woocommerce change price in checkout and cart page" answer code that change the total price in checkout page, I have added some extra code to count the products that user have in cart and if user had like 9 products in cart then add some price to total: add_action( 'woocommerce_before_cart_totals', 'custom_cart_total' , 'get_cart_contents_count'); function custom_cart_total() { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if (WC()->cart->get_cart_contents_count() == 9){ WC

Add a custom field value as a cart non taxable fee in Woocommerce

社会主义新天地 提交于 2020-01-05 07:01:14
问题 I have a custom field in checkout that adds a price to cart. $woocommerce->cart->add_fee($price_info['label'], $fee, $taxable, $tax_class); Everything works fine. But how do i make it non taxable ? 回答1: To make a fee non taxable you need to set the 3rd argument to false, so your code will be: WC()->cart->add_fee( $price_info['label'], $fee ); The default value for the 3rd argument is false , so no taxable. See its source code: /** * Add additional fee to the cart. * * @uses WC_Cart_Fees::add