discount

Cart item quantity progressive percentage discount in Woocommerce 3

橙三吉。 提交于 2019-11-28 12:29:56
问题 I am trying to apply a TOTAL CART discount to all the items in the cart, depending on the quantity of items added. I have taken and modified the code example from answer here and got most of the logic working. I cannot however get it working for two scenarios described below. It also only applies the rule to a single item in the cart. Not the entire cart. Scenario: If no of items in the cart are between 9-12, Apply 5% Discount to all items. If no of items in the cart are between 13-16, Apply

Cart item discount based on quantity in Woocommerce 3

China☆狼群 提交于 2019-11-28 12:07:46
问题 My WP site sells customized t-shirts. The customization plugin makes each customized shirt a line item in the woocommerce cart. If there are 2 shirts ordered of one design (quantity of 2 on that line item) I want to discount. But if there is just 1 item per line I dont want to discount. I found this solution Adding a discount by cart items conditionally based on the item quantity But this seems to change the product price in the db, so after the discount kicks in for say 2 blue shirts because

WooCommerce Cart Quantity Base Discount

跟風遠走 提交于 2019-11-28 11:25:51
In WooCommerce, how do I set a cart discount based on the total number of items in the cart? For example: 1 to 4 items - no discount 5 to 10 items - 5% 11 to 15 items - 10% 16 to 20 items - 15% 21 to 25 items - 20% 26 to 30 items - 25% I've search internet but not found any solution or plugins available. Thanks. LoicTheAztec You can use a negative cart fee to get a discount. Then you will add your conditions & calculations to a acustom function hooked in woocommerce_cart_calculate_fees action hook, this way: ## Tested and works on WooCommerce 2.6.x and 3.0+ add_action( 'woocommerce_cart

Apply a coupon programmatically in Woocommerce

拈花ヽ惹草 提交于 2019-11-27 18:32:37
In Woocommerce I'm trying to find a way to apply a 10% discount to an entire customer's order if the weight in the cart is over 100 lbs. I'm part way to achieving this. For the next step, I'm looking for a way to programmatically apply a coupon code via action/hook through functions.php. It appears that I can use the function woocommerce_ajax_apply_coupon to do this ( http://docs.woothemes.com/wc-apidocs/function-woocommerce_ajax_apply_coupon.html ) but I am unsure of how to use it. So far I've modified cart.php to get the total weight of all the products in the cart, i've created a coupon

Discount for Certain Category Based on Total Number of Products

99封情书 提交于 2019-11-27 07:28:46
问题 In WooCommerce, I have a category of products called Samples, each sample costs $2.99. But I'd like a way to automatically change the cost of the Samples from $2.99 to $1 when 5 Samples are added to cart. So if 4 samples are added to cart, the total would be $11.96… but if 5 were added the total would be $5. So for every 5 products, the product price would change from $2.99 to $1 but if 6 Samples were added to cart the total would be $7.99 and if 10 were added the total would be $10 etc...

Conditional progressive percentage discount based on cart item count in Woocommerce

我们两清 提交于 2019-11-27 07:14:11
问题 I would like to have a conditional progressive discount based on number of items in cart. After you added 2 products to the cart, you get a discount. More products you add and more discount you get. For example: 1 product – full price (No Discount) 2 products – full price with 5% discount of the combined price 3 products – full price with 10% discount of the combined price 4 products – full price with 15% discount of the combined price And so on … I have search over internet without any

WooCommerce Cart Quantity Base Discount

自闭症网瘾萝莉.ら 提交于 2019-11-27 06:12:59
问题 In WooCommerce, how do I set a cart discount based on the total number of items in the cart? For example: 1 to 4 items - no discount 5 to 10 items - 5% 11 to 15 items - 10% 16 to 20 items - 15% 21 to 25 items - 20% 26 to 30 items - 25% I've search internet but not found any solution or plugins available. Thanks. 回答1: You can use a negative cart fee to get a discount. Then you will add your conditions & calculations to a acustom function hooked in woocommerce_cart_calculate_fees action hook,

Display the discounted percentage near sale price in Single product pages for WC 3.0+

那年仲夏 提交于 2019-11-27 02:10:21
I had this code in function.php of my theme to display the percentage after price and it was working fine in WooCommerce v2.6.14. But this snippet doesn't work anymore on WooCommerce version 3.0+. How can I fix that? Here is that code: // Add save percent next to sale item prices. add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 ); function woocommerce_custom_sales_price( $price, $product ) { $percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 ); return $price . sprintf( __(' Save %s', 'woocommerce' ),

Apply a coupon programmatically in Woocommerce

空扰寡人 提交于 2019-11-26 19:29:21
问题 In Woocommerce I'm trying to find a way to apply a 10% discount to an entire customer's order if the weight in the cart is over 100 lbs. I'm part way to achieving this. For the next step, I'm looking for a way to programmatically apply a coupon code via action/hook through functions.php. It appears that I can use the function woocommerce_ajax_apply_coupon to do this ( http://docs.woothemes.com/wc-apidocs/function-woocommerce_ajax_apply_coupon.html ) but I am unsure of how to use it. So far I