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
53
votes
5 answers

Coupon code generation

I would like to generate coupon codes , e.g. AYB4ZZ2. However, I would also like to be able to mark the used coupons and limit their global number, let's say N. The naive approach would be something like "generate N unique alphanumeric codes, put…
Yippie-Ki-Yay
  • 22,026
  • 26
  • 90
  • 148
38
votes
3 answers

Apply a coupon programmatically in Woocommerce

In Woocommerce I'm trying to find a way to apply a 10% discount to an entire customer's order if the weight in the cart is over 100 lbs. I'm partway to achieving this. For the next step, I'm looking for a way to programmatically apply a coupon code…
msargenttrue
  • 425
  • 1
  • 5
  • 11
32
votes
12 answers

Get woocommerce carts total amount

I am trying to apply a discount to a carts total price, but I can only do it to the item base price and not the over all price. I Googled and came across this post in the wordpress stackoverflow: $amount = floatval( preg_replace( '#[^\d.]#', '', …
Howli
  • 12,291
  • 19
  • 47
  • 72
27
votes
1 answer

How to add 'Add to Wallet' button to website to add coupons to Apple Wallet and Google Pay accounts

First off, I don't even know where to begin with this. I've tried reading through the documentation from Apple and Google, but still don't have the right answers. My client already displays coupons on their site, which their customers either print…
yanant
  • 273
  • 1
  • 3
  • 5
20
votes
2 answers

Get coupon data from WooCommerce orders

I have created in WooCommerce two custom coupon types: function custom_discount_type( $discount_types ) { $discount_types['cash_back_fixed'] =__( 'Cash Back fixed discount', 'woocommerce' ); $discount_types['cash_back_percentage'] =__(…
Gaurav
  • 201
  • 1
  • 2
  • 9
15
votes
1 answer

Magento - Single Coupon marked as used when payment pending

I have got a problem with Magento single coupon code that is marked as having been used at the time the customer clicks on the Place Order button. If the Paypal payment fails or the client leaves the page before the order is complete, he won't able…
user1805921
  • 151
  • 1
  • 4
14
votes
1 answer

GET a coupon code via URL and apply it in WooCommerce Checkout page

I have a WooCommerce website and when customer add-to-cart a product, it is get redirected to checkout page, so cart page is not accessible. I would like to apply coupon via URL (GET) on checkout page, with something like…
developerme
  • 1,845
  • 2
  • 15
  • 34
14
votes
1 answer

How WooCommerce Coupons are stored in Database?

I need to run a script to check my coupons every time I have a new register, but I can't find where the coupons from coupon generator (WooCommerce) are stored.
lufizi
  • 403
  • 2
  • 7
  • 14
12
votes
3 answers

WooCommerce: Check if coupon is valid

I am trying to check if a coupon is still valid (hasn't reached its usage limit) and display content under this condition. The reason for this is that I want to be able to hand out a coupon code to particular visitors, but obviously don't want to…
NuclearApe
  • 573
  • 2
  • 6
  • 16
11
votes
3 answers

Why is $address->hasCouponCode() always returning null?

For some reason, the magento website does not apply the coupon codes. It always returns an invalid: Coupon code is not valid message. However, strangely enough, this happens when the price of cart is larger then 120 my currency. If I have one…
Fellner Arthur
  • 217
  • 3
  • 17
9
votes
2 answers

How to programmatically remove applied discount coupons in Woocommerce?

I've been searching for a while but I can't find how to remove woocommerce coupons programmatically. I'm trying to make discounts based on cart total. I need to apply remove coupons because If you have products worth 1000 € (15% discount coupon…
Waltone
  • 93
  • 1
  • 1
  • 6
9
votes
4 answers

Check if a coupon is applied to cart in WooCommerce

I need to find a way to check if a coupon is applied to WooCommerce checkout, if so I would like to do something. I have tried searching around for this and cannot find a solution. Here is a slimmed down version of what I am…
Derek
  • 4,747
  • 7
  • 44
  • 79
8
votes
3 answers

Apply coupon discount via GET method in URL even if cart is empty in WooCommerce

I have a plugin that sends an advocates referral coupon code to e-mails that they enter. When the audience receives this email I'd like to create a flow where they can click on 'SHOP NOW' in the e-mail and the coupon will be automatically added. As…
Mjall2
  • 253
  • 1
  • 9
  • 24
8
votes
2 answers

How do I get an external page coupon/voucher form to work in OpenCart?

I have another page in my OpenCart environment, let say the about us page, which has these forms below, assuming the user has items in their cart, these forms should work but they do not: Enter your coupon code here:
TheBlackBenzKid
  • 26,324
  • 41
  • 139
  • 209
7
votes
1 answer

Programmatically create auto generated coupon codes in Magento?

Based on other stackoverflow posts, I've been able to use the following code to programmatically generate individual shopping cart price rule coupons in Magento. How can I programmatically call the "Auto Generate Coupon" feature to create 100…
Evan Crouch
  • 283
  • 1
  • 3
  • 8
1
2 3
33 34