discount

Quantity discount on 2nd item only in Woocommerce

僤鯓⒐⒋嵵緔 提交于 2019-12-24 11:23:25
问题 I want to achieve a global discount for all products but only for the 2nd product item. What do I mean? If the customer buys "Jacket" no discount is given. Customer buys two of the "Jacket" product. 20% discount is given on the second "Jacket". Customer buys five of the "Jacket" product. Still only 20% discount on the 2nd "Jacket". It should work for all both simple and variable products. I managed to figure this much out and I'm asking for help with how to make the discount apply to only the

Discounts via PayPal REST API sample?

南楼画角 提交于 2019-12-23 19:57:08
问题 PayPal GURUS, i need a help, how to insert discount, i use REST API, may be some one, can show sample of code?Is there any way to send discount amount using PHP REST API? 回答1: At this moment, discounts are not supported in the REST payments API. Your best bet would be to compute the discounted amount on your end and use that as the subtotal as transactions.amount.details.subtotal (https://developer.paypal.com/webapps/developer/docs/api/#create-a-payment). It is a planned future enhancement,

How to apply an automatic discount in WooCommerce based on cart total?

家住魔仙堡 提交于 2019-12-23 01:28:24
问题 Referring to this question How do I programmatically apply a coupon in Woocommerce? I'm looking for something very similar to the final solution in the first post, but I'd like the coupon to be applied if the subtotal is > 99 euros. How do you think I can modify the code? And since I'm a newbie... where do I have to paste the whole code? Thanks a lot 回答1: Something like this could be done: add_action('woocommerce_before_checkout_process','add_discount_at_checkout'); function add_discount_at

Woocommerce global percentage discount on simple products if customer is logged in

一个人想着一个人 提交于 2019-12-22 09:46:16
问题 I'm looking for advice on what's wrong with the following function. My goal in this example is to apply a 50% off discount to all WooCommerce simple products, as long as the user is logged in. function tier_pricing_logic() { if ( is_user_logged_in() ) { function assign_tier_pricing( $price, $product ) { $price = $price * 0.5; // Set all prices for simple products to 50% off. } return $price; add_filter('woocommerce_product_get_price', 'assign_tier_pricing', 90, 2 ); add_filter('woocommerce

Progressive discount based on cart total in WooCommerce

点点圈 提交于 2019-12-18 04:27:08
问题 I'm trying to automatically apply 3 different coupon codes in WooCommerce Cart. Here's my code! add_action( 'woocommerce_before_cart', 'apply_matched_coupons' ); function apply_matched_coupons() { global $woocommerce; $coupon_code5 = '5percent'; $coupon_code10 = '10percent'; $coupon_code55 = '15percent'; if ( $woocommerce->cart->has_discount( $coupon_code ) ) return; if ( $woocommerce->cart->cart_contents_total >= 50 && $woocommerce->cart->cart_contents_total < 100 && $woocommerce->cart->cart

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

故事扮演 提交于 2019-12-17 05:12:24
问题 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

Adding a discount by cart items conditionally based on the item quantity

时光总嘲笑我的痴心妄想 提交于 2019-12-12 15:35:26
问题 I have set up a Woocommerce shop and wish to set up a specific discount on all products based on multiples of 12 (a box). I've tried many discount plugins but haven't found what I am looking for. For example, if I order 12 of product X, I get a 10% discount. If I order 15 of product X, I get a 10% discount on the first 12, and the last three are full price. If I order 24, then that 10% discount applies to all 24 of product X. The closest I have found is this: Discount for Certain Category

Paypal add to cart multiple items form with discount

坚强是说给别人听的谎言 提交于 2019-12-12 05:19:59
问题 I'm trying to offer a discount based on the purchase amount of the buyer using a paypal Add to Cart form. Basically I'm giving out for discount codes Disc1, Disc2, Disc3, Disc4, which will discount $5, $10, $20, $50. But each can work only if the purchase amount exceeds the $25, $50, $100, $250 respectively. I'm trying to do this by calling a Javascript file which will apply the discount if the minimum price conditions are met. The PROBLEM is that the form is for multiple items. So the

Woocommerce conditional part cart discount on the same product present with > 1 variation

只愿长相守 提交于 2019-12-12 03:48:16
问题 My woocommerce products are actually cruise expeditions (two products = two expedition types). For each product, the variations consists of the weeks in which cruises take place (= dates). So I have Ligurian Sea Expeditions with 20 different weeks and Greece Expeditions with other 20 weeks. Fortunately I have just 2 products like that to deal with (a very simple situation) The customer usually chooses one week expedition. However I need to apply a 10% discount on the second (or third) week in

How do I programmatically apply a coupon in Woocommerce for first order made by a customer?

梦想的初衷 提交于 2019-12-12 03:03:53
问题 In Woocommerce I'm trying to find a way to apply a 20% discount to the first order made by a new customer. It appears that I can use the functions woocommerce_after_checkout_validation and check_new_customer_coupon to do this but it doesn't work. function.php: add_action('woocommerce_after_checkout_validation','check_new_customer_coupon', 0); function check_new_customer_coupon(){ global $woocommerce; // you might change the name of your coupon $new_cust_coupon_code = 'test'; $has_apply_coupon