discount

Apply a progressive discount based on Woocommerce cart weight

旧巷老猫 提交于 2020-08-26 13:31:07
问题 I'm looking for a way to apply a discount (percentage) based on cart total weight. Example: 10 to 25 kg, set a 5% discount 26 to 50 kg, set a 7,5% discount 51 to 100 kg, set a 10% discount 101 to 150 kg, set a 12,5% discount more than 150 kg, set a 15% discount When one of the rules will be applied there should be a message also like this payment discount shown in the picture. Payment method discount And if also possible showing a message box like the 'added to cart message box' which shows

Set a percentage discount to Local pickup shipping method in Woocommerce

会有一股神秘感。 提交于 2020-08-04 19:20:26
问题 I have a WordPress site which uses WooCommerce plugin. I would like to offer buyer 5% reduction from cart total if they select local pickup as a shipping method. I already tried - 5 * [qty] and it doesn't seem to be working. I also tried -0.95 * [cost] with no luck 回答1: I am using WooCommerce 3 and achieved the above result by writing a function inside the function.php of active theme. function prefix_add_discount_line( $cart ) { $chosen_methods = WC()->session->get( 'chosen_shipping_methods'

Set a percentage discount to Local pickup shipping method in Woocommerce

丶灬走出姿态 提交于 2020-08-04 19:20:06
问题 I have a WordPress site which uses WooCommerce plugin. I would like to offer buyer 5% reduction from cart total if they select local pickup as a shipping method. I already tried - 5 * [qty] and it doesn't seem to be working. I also tried -0.95 * [cost] with no luck 回答1: I am using WooCommerce 3 and achieved the above result by writing a function inside the function.php of active theme. function prefix_add_discount_line( $cart ) { $chosen_methods = WC()->session->get( 'chosen_shipping_methods'

WooCommerce discount: buy one get one 50% off with a notice

自作多情 提交于 2020-07-27 23:40:47
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

WooCommerce discount: buy one get one 50% off with a notice

落爺英雄遲暮 提交于 2020-07-27 23:29:45
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

WooCommerce discount: buy one get one 50% off with a notice

[亡魂溺海] 提交于 2020-07-27 23:26:20
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

WooCommerce discount: buy one get one 50% off with a notice

老子叫甜甜 提交于 2020-07-27 23:26:11
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

WooCommerce discount: buy one get one 50% off with a notice

爱⌒轻易说出口 提交于 2020-07-27 23:23:35
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

Local pickup shipping option custom percentage discount in Woocommerce

自闭症网瘾萝莉.ら 提交于 2020-05-16 12:39:54
问题 My WooCommerce checkout page gives some shipping options: Flat Rate (costs money) Local Pickup (free). How can I give a 5% discount on total order cost if a customer chooses Local Pickup shipping method? 回答1: The following code will add a discount of 5% to cart subtotal for Local Pickup chosen shipping method: add_action( 'woocommerce_cart_calculate_fees', 'custom_discount_for_pickup_shipping_method', 10, 1 ); function custom_discount_for_pickup_shipping_method( $cart ) { if ( is_admin() && !