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
4
votes
1 answer

Conditionally adding a cart fee if no coupons are applied to cart

In WooCommerce, I am trying to figured out how to add a "Handling Fee" to every order when no coupons or promo codes are applied to cart. Here's my "Fee" or "Handling Charge" code: add_action(…
miic
  • 43
  • 5
4
votes
1 answer

“Get product X for free on orders over $100” coupon code in WooCommerce

Is there any simple way or any plugin around that allows to create a coupon code for the following kind of offer: "get product X for free on orders over $100"?
drake035
  • 3,955
  • 41
  • 119
  • 229
4
votes
3 answers

Magento 1.9.1.1 Coupon Code is Not Valid

I am using Magento version 1.9.1.1. I am trying to set-up a discount coupon code for some customers who will be able to order 6 items completely free of charge.But for some reason, I keep getting "Coupon code "XYZ" is not valid. I investigated,but…
PBCoder
  • 71
  • 1
  • 8
4
votes
2 answers

How can I import bulk coupon to woocommerce from csv

I'm trying to import about 1000 coupon codes to woocoommerce from a csv file I've used this code but it's not working this code can generate 1 coupon programmly : $coupon_code = 'UNIQUECODE'; // Code $amount = '10'; // Amount $discount_type =…
iCode98
  • 41
  • 1
  • 7
4
votes
3 answers

magento: URL querystring for adding product and applying discount coupon to cart

I am a newbie, after extensive research and exploration I am able to figure out the following: To add a product to cart I can use /checkout/cart/add?product=76&qty=1 to apply discount code I can…
rukpat
  • 99
  • 2
  • 7
3
votes
1 answer

Creating a WooCommerce promo code after order completion

On a WooCommerce website I'm selling a gift voucher where the client can input the amount he wants to gift himself, I'd like after an order is paid that a WooCommerce promo code is created with the corresponding amount. This is the code I came up…
Isisky
  • 33
  • 2
3
votes
1 answer

WooCommerce: Double discount on sale products with coupon

I want to double the discount for products on sale with a coupon code. For example: The product is on sale with a 10% discount. If I add the coupon code doublediscount I want to double that discount to 20%. The coupon discount should have limit of…
Cray
  • 5,307
  • 11
  • 70
  • 166
3
votes
1 answer

Display the total amount of sales generated by coupon in a new column on WooCommerce admin coupon list

I am using the following code https://www.businessbloomer.com/woocommerce-calculate-sales-coupon-code/ that allows me to display the total amount of sales generated by a given coupon code in a new tab on WooCommerce "Reports". /** * @snippet Get…
Jod
  • 87
  • 5
3
votes
2 answers

Display coupon usage count and limit in WooCommerce thank you page

I want to display the remaining number of the coupon on the WooCommerce thankyou page For example: You used the test coupon 3 times and there are 10 more left. This is my code: add_action('woocommerce_after_cart_table', 'coupon_count'); function…
Sinapars
  • 33
  • 4
3
votes
1 answer

Show used coupon in WooCommerce order quick view

We use this code to display the used coupons on a order. This is working fine! But now we want to show this information also in the order quick view. I found this hook here: woocommerce_admin_order_preview_end So i tried to change the hook from the…
Nik7
  • 346
  • 2
  • 16
3
votes
1 answer

Display used coupons on WooCommerce admin orders list

Below code for a print coupon on order page add_filter( 'manage_edit-shop_order_columns', 'custom_shop_order_column', 20 ); function custom_shop_order_column($columns) { $reordered_columns = array(); foreach( $columns as $key =>…
3
votes
1 answer

Create multiple coupons programmatically in WooCommerce 3+

In wooCommerce, I am using the following code to create programmatically a single coupon: $coupon_amount = '20'; $code_value = wp_generate_password( 15, false ); $coupon_code = $code_value; $expiry_date = date('Y-m-d',…
Athira
  • 31
  • 3
3
votes
0 answers

How to check if a coupon has granted free shipping in Woocommerce?

ORIGINAL QUESTION: We need to know if a coupon has specifically granted free shipping. In my test scenario I have two coupons applied to the cart, one with free shipping and one without. The var_dump clearly shows one coupon like this: …
AJD
  • 371
  • 4
  • 14
3
votes
2 answers

Applying a WooCommerce coupon conditionally based on product attribute terms

I am trying to exclude some product variations that have specific product attributes from coupon discounts. In my case I am targeting product variations that have a product attribute "finish" set to "Classic Frame" or "Box Frame" term. I tried to…
MitchellK
  • 2,322
  • 1
  • 16
  • 25
3
votes
1 answer

Automatic discount for paying customers in WooCommerce

I want to apply a discount coupon automatically to everyone who has made at least one purchase on my website. This is the code that I tried but I get a fatal error on the page ... function has_bought( $customer_email ){ $orders =…