discount

WooCommerce progressive quantity discount for specific product categories

烂漫一生 提交于 2021-02-10 15:56:51
问题 I was researching a method to give a progressive discount if you have more than 1 product in the cart. I found this thread and actually using this code: //Discount by Qty Product add_action( 'woocommerce_before_calculate_totals', 'quantity_based_pricing', 9999 ); function quantity_based_pricing( $cart ) { global $product; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return; // Define discount rules and thresholds and

WooCommerce progressive quantity discount for specific product categories

余生长醉 提交于 2021-02-10 15:54:07
问题 I was researching a method to give a progressive discount if you have more than 1 product in the cart. I found this thread and actually using this code: //Discount by Qty Product add_action( 'woocommerce_before_calculate_totals', 'quantity_based_pricing', 9999 ); function quantity_based_pricing( $cart ) { global $product; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return; // Define discount rules and thresholds and

WooCommerce promotional discount: Buy 10 Get 1 Free

守給你的承諾、 提交于 2021-02-08 08:36:16
问题 I'm trying to set up a specific discount for three variable products (464, 465 and 466). If a customer buys ten products they get one for free. Based on WooCommerce discount: buy one get one 50% off answer code, I've come up with the following code: add_action('woocommerce_cart_calculate_fees', 'add_custom_discount_11th_at_100', 10, 1 ); function add_custom_discount_11th_at_100( $wc_cart ){ if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; $discount = 0; $items_prices = array(); // Set

Add a discount for specific selected payment method in WooCommerce

 ̄綄美尐妖づ 提交于 2021-02-07 04:19:47
问题 Without a using coupon functionality I would like to apply a 15% discount for a specific payment method ID like 'xyz'. I would like help identifying which hooks to use. The general idea of what I would like to achieve is: if payment_method_hook == 'xyz'{ cart_subtotal = cart_subtotal - 15% } The customer does not need to see the discount on this page. I would like the discount to be submitted properly, only for the specific payment method. 回答1: You can use this custom function hooked in

Custom discount for every NTH item in the cart

て烟熏妆下的殇ゞ 提交于 2021-01-28 08:04:39
问题 I came here from this question here looking to find a solution for my WooCommerce site. I am looking for a way to get a discount in my cart only for even number of items in the cart. For example: If there's only 1 item in the cart: Full Price 2 Items in the cart: - (minus) 2$ for both of it 5 Items in the cart: - (minus) 2$ for 4 of it (if there's odd number of items in the cart. 1 item will always have the full price) By the way, all of my products are having the same price. Would someone be

Apply a 100% coupon discount on the cheapest cart item in WooCommerce

眉间皱痕 提交于 2021-01-24 08:14:07
问题 I have created a ' BOGOF ' (buy one get one free) coupon, using the normal woocommerce coupon method. The coupon gives the user 100% percentage discount on 1 other item in the cart. Coupon settings General: Discount type: Percentage discount Coupon amount: 100 Usage limits: Limit usage to X items: 1 When used: Coupon applies 100% to a random item in the cart (default behavior, I guess) Desired: It needs to take 100% off the cheapest item in the cart. With the following code I try to achieve

Apply a 100% coupon discount on the cheapest cart item in WooCommerce

。_饼干妹妹 提交于 2021-01-24 08:13:27
问题 I have created a ' BOGOF ' (buy one get one free) coupon, using the normal woocommerce coupon method. The coupon gives the user 100% percentage discount on 1 other item in the cart. Coupon settings General: Discount type: Percentage discount Coupon amount: 100 Usage limits: Limit usage to X items: 1 When used: Coupon applies 100% to a random item in the cart (default behavior, I guess) Desired: It needs to take 100% off the cheapest item in the cart. With the following code I try to achieve

WooCommerce product custom discounted price for logged in users

做~自己de王妃 提交于 2021-01-01 06:43:47
问题 I have a question about managing prices in WooCommerce. I have a store only with simple products. Let's say that for all subscribers and customers the regular price of each product is discounted by 10%. This was easy: function custom_price( $price, $product ) { global $post, $blog_id; $post_id = $post->ID; get_post_meta($post->ID, '_regular_price'); if ( is_user_logged_in() ) { return $price = ($price * 0.9); } else{ return $price; } } add_filter( 'woocommerce_get_price', 'custom_price', 10,

WooCommerce product custom discounted price for logged in users

烂漫一生 提交于 2021-01-01 06:40:35
问题 I have a question about managing prices in WooCommerce. I have a store only with simple products. Let's say that for all subscribers and customers the regular price of each product is discounted by 10%. This was easy: function custom_price( $price, $product ) { global $post, $blog_id; $post_id = $post->ID; get_post_meta($post->ID, '_regular_price'); if ( is_user_logged_in() ) { return $price = ($price * 0.9); } else{ return $price; } } add_filter( 'woocommerce_get_price', 'custom_price', 10,