coupon

Set all shipping methods cost to zero for a Free shipping coupon in Woocommerce

故事扮演 提交于 2021-02-19 05:31:19
问题 I have 3 shipping methods in my cart that should become zero prices as soon as your customer enters Free Shipping coupon. I know how to add a filter in functions.php to detect the coupon but is someone know a snippet to set shipping methods visibles in cart (radio button) to ZERO for this order? My deliveries methods are companies like UPS, FedEx... I activated the free shipping option in order it can be managed with coupon. The list of choice of deliveries methods for the customers is

Set all shipping methods cost to zero for a Free shipping coupon in Woocommerce

孤人 提交于 2021-02-19 05:31:17
问题 I have 3 shipping methods in my cart that should become zero prices as soon as your customer enters Free Shipping coupon. I know how to add a filter in functions.php to detect the coupon but is someone know a snippet to set shipping methods visibles in cart (radio button) to ZERO for this order? My deliveries methods are companies like UPS, FedEx... I activated the free shipping option in order it can be managed with coupon. The list of choice of deliveries methods for the customers is

Setting a tax class based on specific coupon in Woocommerce

杀马特。学长 韩版系。学妹 提交于 2021-02-10 20:52:05
问题 This has been answered a while back but the filter is not working anymore. Not sure if it is deprecated or not. I am using both filters: woocommerce_product_tax_class woocommerce_product_get_tax_class My function looks like: function wc_diff_rate_for_user( $tax_class, $product ) { $tax_class = "Zero rate"; return $tax_class; } add_filter( 'woocommerce_product_tax_class', 'wc_diff_rate_for_user', 1, 2 ); How can I set a tax class based on specific coupon in Woocommerce? 回答1: Since Woocommerce

Limit to one applied coupon, removing other previous applied coupons in Woocommerce

白昼怎懂夜的黑 提交于 2021-01-28 11:48:50
问题 I am making coupon dynamically to use user email as coupon but how can I restrict user to use only one coupon per cart. If use multiple auto removed the previous one from cart. add_filter ( 'woocommerce_get_shop_coupon_data', 'generate_coupons', 10, 2 ); function generate_coupons( $data, $code) { global $wpdb, $woocommerce; $vpm_options = get_option( 'vpm_email_coupon_option_name' ); // Array of All Options $amount = $vpm_options['coupon_value_3']; // coupon_discount $offer_type = $vpm

Add a new column with author name to WooCommerce admin coupon list

痴心易碎 提交于 2021-01-27 20:23:07
问题 Yesterday we had the situation, that someone ask my "Who created this coupon?". Unfortunately WooCommerce by default does not display the creator of the coupon in the coupon overview where all coupon are listed. What I try to find out is, how can I add a new column with the author name in the WooCommerce > Marketing > Coupons overview. This what I have so far: function display_coupon_creator() { foreach( $coupons as $coupon ){ // Get coupon creator $coupon_creator_id = get_post_field('post

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

Retrieve coupon details from coupon code WooCommerce [duplicate]

强颜欢笑 提交于 2021-01-20 18:37:50
问题 This question already has answers here : Set a coupon description in WooCommerce (1 answer) Get coupon data from WooCommerce orders (1 answer) Closed 3 years ago . I have previously asked this question however it does not answer the question of how to retrieve data from a coupon in WooCommerce. Both questions involve coupons, however, the first question is asking how does one set the metadata and this question asks how you retrieve the data. I am trying to get the details of a coupon from

Hide coupon discount raw if no coupon has been applied on WooCommerce cart page

故事扮演 提交于 2021-01-07 01:02:51
问题 I add coupons and discounts total savings to my cart page. My code works fine but I have an additional question. This is the code I am currently using: add_action( 'woocommerce_cart_totals_before_shipping', 'show_total_discount_cart_checkout', 9999 ); function show_total_discount_cart_checkout() { global $woocommerce; $discount_total = 0; foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) { $product = $values['data']; if ( $product->is_on_sale() ) { $regular_price = $product->get

Hide coupon discount raw if no coupon has been applied on WooCommerce cart page

久未见 提交于 2021-01-07 00:57:49
问题 I add coupons and discounts total savings to my cart page. My code works fine but I have an additional question. This is the code I am currently using: add_action( 'woocommerce_cart_totals_before_shipping', 'show_total_discount_cart_checkout', 9999 ); function show_total_discount_cart_checkout() { global $woocommerce; $discount_total = 0; foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) { $product = $values['data']; if ( $product->is_on_sale() ) { $regular_price = $product->get