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

Set Coupon used_by Customer ID manually

I am looking for a documentation regarding setting a coupon's used_by particular customer user_id on Woocommerce if coupon code to be added manually via REST API or from the Admin create new order endpoint. But I find no way to do it correctly.…
Calvin Seng
  • 193
  • 1
  • 19
1
vote
0 answers

WooCommerce: Coupon field doesn't show error or success messages after moving the form

I've moved the coupon field in the cart from the items table to the cart totals table. Everything works fine so far. But after adding a code, the form doesn't show any error or success messages. I tired to figure out why that's the case but couldn't…
Cray
  • 5,307
  • 11
  • 70
  • 166
1
vote
1 answer

Paypal express - adding an "agent code" field (doesn't need to modify the price)

I've been reading up about paypal express and I'm trying to work out if I could add an extra field to collect the agent code. It's just something simple, it's just a code like "AGENT-X" that could sit in a field like the comments, or hopefully it's…
Jason
  • 15,064
  • 15
  • 65
  • 105
1
vote
0 answers

Create bulk coupons using smart coupons - but compulsory for products in a certain category

I am using "Get a coupon code dynamically from WooCommerce in a custom function" answer code, which ensures that specific products requires a coupon code in order to complete the purchase. Really awesome. However I also used Woo Smart Coupons to…
1
vote
0 answers

Can I change the order WooCommerce Coupons are applied programmatically?

I am developing a Woocommerce shop and want to offer all members (users logged in) 20% off their Total. I have created a coupon called "twentypercent_off" and I am programmatically applying this using a custom function and a hook in my…
radiation2
  • 11
  • 2
1
vote
1 answer

Get Woocommerce Coupon ID on thankyou.php

I'm trying to pass a few order details to a third party on the Woocommerce thankyou page. Everything works fine—except getting the coupon ID. What am I missing? I've read through this question, but didn't illuminate the subject too much. Doesn't…
Luke Finsaas
  • 63
  • 1
  • 6
1
vote
3 answers

How to delete a coupon using api and coupon code in WooCommerce

In WooCommerce, I created a coupon like this. $coupon_data = [ 'code' => $code, 'amount' => '15', ]; $wooCommerceMRLiveV2 = WooCommerceConnection::wooCommerceMRLiveV2(); $retval2 = $wooCommerceMRLiveV2->post('coupons', $coupon_data); And…
Ma Long
  • 135
  • 2
  • 11
1
vote
0 answers

Woocommerce coupon apply automatically on cart and checkout page

I need a coupon to be applied automatically when a product selects a custom field in it ( a checkbox as custom field) .If that checkbox is ticked in that product then woo commerce coupon should be applied automatically on cart and checkout page also…
sarah
  • 11
  • 1
1
vote
0 answers

How to apply a coupon to an existing woocommerce subscription

I'm looking for a way to apply coupons to existing woocommerce subscriptions. I create coupons and then under usage restrictions I set the allowed emails to the be the email of a certain user/subscriber. I would like these coupons to be…
GW123
  • 23
  • 5
1
vote
1 answer

How to trash expired and used coupons in Woocommerce automatically?

In my functions.php I want to add a function that moves expired coupons and/or coupons that have reached their usage limit to the trash. I would like to trash coupons that have a usage limit of 1 and a usage count of 1 or more. I would like this…
GW123
  • 23
  • 5
1
vote
1 answer

Display custom data on Woocommerce admin coupon edit pages

For every coupon I have defined in the system I would like to show usage statistics: how much sales it was used with, how much discount it provided, etc... I would like to add that data on that coupon's edit page in the admin (either as a new tab or…
Louis Shraga
  • 773
  • 1
  • 7
  • 26
1
vote
1 answer

Get Coupon code applied to the product in woocommerce

I am trying to retrieve the shop coupon code applied to a particular product. I used the below code but it did not work. $WC_Cart = new WC_Cart(); $var = $WC_Cart->get_applied_coupons(); Can anyone please help me to get the solution. Thanks in…
Praveen
  • 985
  • 8
  • 31
1
vote
1 answer

Laravel Cashier `->withCoupon()->swap()` not working

I'm trying to update a subscription and add a coupon at the same time. Here's the code: $user->subscription('subscription_name')->withCoupon($request->stripe_coupons)->swap($planName); The error I'm getting is Call to undefined method…
TH1981
  • 3,105
  • 7
  • 42
  • 78
1
vote
3 answers

Where is the setCouponCode function is defined in Magento

I know that setCouponCode is catch inside __call in Varien_Object but I can't figure out where it is defined. I need it because I want to show the coupon code even if the discount equal zero. I believed it's done inside this function. So if anybody…
stunti
  • 855
  • 8
  • 20
1
vote
1 answer

How to create edd disocunt-code with programming?

I am working in wordpress edd plugin, in which i have requirement of create edd coupon code dynamically with specific amount, start date, end date and assign user to that code. I have not found any filter/action hook that will accomplish this task.…
Abhee
  • 425
  • 1
  • 5
  • 17