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
6
votes
2 answers

Applying programmatically a coupon to an Order in WooCommerce3

I'm developing a plugin that creates an order directly (no cart) and applies a coupon. In version 3.0 of the woo API the function add_coupon() has been deprecated in favour of a WC_Order_Item_Coupon object you add to the order. Create the coupon…
Benjamin Beaumont
  • 910
  • 1
  • 6
  • 14
6
votes
1 answer

Retrieve coupon details from coupon code WooCommerce

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…
Marcello B.
  • 4,177
  • 11
  • 45
  • 65
6
votes
1 answer

How to retrieve a list of WooCommerce orders which use a particular coupon?

I'm trying to write a function that retrieves a list of WooCommerce orders which use a specified coupon code and are in a specified date range, then sums the total discounts applied to those orders. After a little googling I feel like I should be…
capsid
  • 135
  • 1
  • 11
5
votes
1 answer

WooCommerce validate coupon by expiry date and time

I am using woocommerce and I wanna validate a coupon not only by the default built-in expiry date checking, but also expiry time as well. I have added a custom field to coupons, that allows to set an expiry time. I wrote the following code snippet…
Hugo1280
  • 53
  • 1
  • 5
5
votes
1 answer

Get coupon description From WooCommerce order applied coupons

I'm trying to display used coupons on WooCommerce order emails + add THE DESCRIPTION. Displaying coupons is working based on: Add Applied Coupon Code in Admin New Order Email Template - WooCommerce I also tried this: $coupons = $order->get_items(…
Rubén
  • 53
  • 4
5
votes
1 answer

Replace Woocommerce coupon amount line by a custom string

currently in checkout page and cart page after people apply coupon code then cart showing coupon name and how much money reduced from original product price . For example product price is 100 and discount is 20% for coupon then it showing coupon…
Abilash Erikson
  • 341
  • 4
  • 26
  • 55
5
votes
6 answers

Woocommerce Orders Rest API: Add a coupon code

I have Visited The official WooCommerce Rest API documentation "Create an Order" section. I am trying to create an order via the API, but when I want to create the order with the apply coupon, I don't know how to make it. How I will pass the coupon…
Ajay Ghaghretiya
  • 784
  • 1
  • 6
  • 30
5
votes
2 answers

Hide specific variations

How can I hide a variation from the dropdown on a product page, but still let it be purchased through WooCommerce URL coupons? If I make the variation not active, it is hidden from the drop down, but I get the message "This product can not be…
Virik
  • 397
  • 1
  • 4
  • 18
5
votes
2 answers

Rails : Stripe : Updating existing subscription with new coupon code

I have a subscription and if I update it with coupon how is the coupon going to apply? Client has already paid the amount and now I am going to apply a 100% discount coupon by editing from my admin dashboard. How is this handled? thanks
Shiva
  • 11,485
  • 2
  • 67
  • 84
5
votes
1 answer

How can I apply a Woocommerce Coupon to a specific user role without a plugin?

I have implemented a wholesale user role into my client's Wordpress site. The end goal is to have the wholesale user have a 40 % discount on all products, but if they spend $500.00 or more, they get an additional 7% off of the total cart purchase. I…
jshuadvd
  • 552
  • 5
  • 16
5
votes
4 answers

Run PHP code after button click but without refreshing page

I have a form in HTML to apply a Discount Coupon to a current shopping cart. I would like the user to just click on APPLY (after entering the coupon code) and then without refreshing the page, to have some PHP code run so it computes the…
samyb8
  • 2,560
  • 10
  • 40
  • 68
5
votes
1 answer

Deleting a large number of Magento coupons (shopping cart price rules) programatically

I've been on here before asking about writing code to get Magento to generate a random coupon code for a new e-mail subscriber - Creating a single random Magento coupon This code worked perfectly and to those who helped I am eternally grateful. I am…
Kale
  • 601
  • 1
  • 8
  • 25
4
votes
1 answer

Display used coupons in a custom column in WooCommerce "My account" orders table

My intention is to display the coupons used in an order, in a custom column in the order table of WooCommerce "My Account". Image of table on site: My code attempt: add_filter( 'woocommerce_account_orders_columns', 'add_coupon_codes_column'); …
Jake W
  • 43
  • 3
4
votes
1 answer

How to get coupons from email restrictions with efficiency in WooCommerce

I have the following loop for getting Woocommerce coupons on a page within the my account section of a customers dashboard. Currently we have 10k+ coupons and just by performing this loop, it's a huge drain on resources and not very efficient…
Rob
  • 6,304
  • 24
  • 83
  • 189
4
votes
1 answer

Exclude products with specific attributes terms from WooCommerce coupons

I would like to exclude from all WooCommerce coupons the products that have a specific attribute (e.g. attribute_pa_brand => mybrand). I followed this answer Exclude variations with 2 specific attribute terms from coupon usage in Woocommerce but it…
SierraEcho
  • 151
  • 1
  • 12
1
2
3
33 34