Questions tagged [coupon]

For questions related to performing discounts on eCommerce transactions. (Please do not use this tag for questions regarding financial calculations regarding bond coupons and interest rates.)

This tag refers to performing discounts on eCommerce transactions (i.e. taking coupons in the applications OpenCart, Magneto, or WooCommerce applications.) Besides the logic to implement the discounts, this tag could also refer to generation of unique or batch coupon codes.

For financial calculations regarding bond coupons and interest rates, please use a different suitable tag, such as:

499 questions
1
vote
1 answer

Add sorting to "code" column in WooCommerce coupon list

I am trying to alphabetically and numerically sort the coupon code admin column. I have some coupons that is made up with only numbers and others that is only letters. I would like to display: All the numbers coupon codes in numerical order and…
Schalk Joubert
  • 398
  • 3
  • 19
1
vote
1 answer

Apply woocommerce_coupon_get_discount_amount only to percent type coupons

I have created the following functions to override the product price and make a max discount for WooCommerce. However, I can't seem to figure out why the woocommerce_coupon_get_discount_amount filter is applying to all coupons. The way I am trying…
1
vote
1 answer

Apply discount/coupon ONLY for backordered products

I'm trying to add a discount code just for backordered items, I found this one on here and it works for ALL items, not just backordered items, how can I fix this? Thanks in advance! add_filter( 'woocommerce_coupon_is_valid',…
Ale
  • 25
  • 5
1
vote
1 answer

How to auto generate a coupon in WooCommerce and apply it to the cart?

I have scoured the net and many pages here on stackoverflow. I’m trying to set up a WooCommerce abandoned cart flow where an auto generated coupon in WooCommerce can be added to the cart. I have butchered various code that I’ve found. I have it…
Stoto
  • 41
  • 1
  • 8
1
vote
1 answer

Auto apply coupon based on WooCommerce cart subtotal in which certain products are excluded

I am using the following code to auto apply a coupon when customer has $100 or more in cart. add_action( 'woocommerce_checkout_before_order_review' , 'add_coupon_notice' ); function add_coupon_notice() { $cart_total =…
1
vote
1 answer

Change WooCommerce coupon label for different coupon names in cart totals

I need to change the default coupon label that WooCommerce is adding to the cart and checkout table. This can be done with: add_filter( 'woocommerce_cart_totals_coupon_label', 'my_function', 99, 2 ); function my_function( $label, $coupon ) { …
sarah579
  • 35
  • 4
1
vote
1 answer

Show cash on delivery (COD) based on applied coupons in WooCommerce

I am trying to have cash on delivery (COD) enabled only for customers that use certain type off coupons. I have an existing code that, when coupons of a certain type are entered, converts the product sales price to the regular product price. Now I…
neppers
  • 75
  • 6
1
vote
1 answer

Can't auto refresh a checkout page after adding/removing a coupon (EA Woo Checkout)

Problem: Checkout page shows a correct translated price, but it turns to a default language price after adding / removing a coupon code. When I refresh the page manually, it shows a translated language price. Need Help: Would you please let me know…
namari
  • 129
  • 1
  • 9
1
vote
1 answer

Add coupon names and percentage to WooCommerce view order details and email notifications

I used Add the Coupon Code names to Woocommerce View Order details and email notifications to inspire my snippet. I'm trying to expand the snippet to also include the coupon percentage amount in brackets, if the coupon type is a percentage…
1
vote
1 answer

Coupon with 2 differents fixed product discounts based on product IDs in WooCommerce

I have come across Coupon with 2 different percentage discounts based on product category in Woocommerce Which shows how to alter % discounts for set categories. I want to implement a summer discount code on my store which gives £20 off to a…
Henry Aspden
  • 1,863
  • 3
  • 23
  • 45
1
vote
1 answer

Add dropdown list on WooCommerce checkout page when coupon is applied

I created a function to add a drop-down field before payment info at checkout page. The following is working when i tried the add_action function. add_action('woocommerce_review_order_before_payment', 'add_store_selection'); function…
specex
  • 41
  • 5
1
vote
2 answers

Delete WooCommerce coupons 30 days after they expire

I have the following function, which deletes WooCommerce coupons on the day they expire. How do you make it delete them 30 days after their expiry date instead? function delete_expired_coupons() { $args = array( 'posts_per_page' => -1, …
NuclearApe
  • 573
  • 2
  • 6
  • 16
1
vote
1 answer

Enable free shipping for a min amount based on WooCommerce discounted subtotal

In WooCommerce we have set flat_rate shipping amount to 4.95€ and free_shipping shows up for a minimal total amount of 45€. Now, if a customer has a cart with - let`s say 48€ - he does not have to pay shipping costs, as he has reached the order…
Neil Fender
  • 75
  • 1
  • 10
1
vote
1 answer

Coupon daily time range in WooCommerce

I'm tying to enable the use of coupons to a range of hours in Woocommerce without success. Based on Discount on specific products based on a daily time range in Woocommerce answer, my code is: // Utility function that gives the discount daily…
daviecdlh
  • 55
  • 4
1
vote
1 answer

Get WooCommerce orders by coupon code and date range with a SQL Query

I am trying to get order data by coupon code and date. I have added this code. But how to find the data by coupon code and date? $date_from = '2015-11-20'; $date_to = '2015-12-20'; $post_status = implode("','", array('wc-processing', 'wc-completed')…
Kane
  • 605
  • 2
  • 8
  • 22