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

Disable coupons for subscription products in WooCommerce

I am trying to disable coupon codes for my WooCommerce Subscriptions that I have set up through the "all products for subscription" add on. I've tried the snippet below but it's not targeting subscription products added through the "all products for…
1
vote
1 answer

How to display the current applied coupon slug in Woocommerce?

My goal : Retrieve the coupon code applied (only one coupon code can be applied on the cart page) and create a custom link 'Remove Coupon'. My problem : I can't figure out how to display in my 'Remove Coupon' link's href the current applied coupon…
1
vote
1 answer

Disable free shipping for specific coupon codes in WooCommerce

I am trying to remove the free shipping option in Woocommerce when someone uses a specific coupon code. I found this question which is very relevant to my question. The answer bellow seems really close to what I am looking for. I am new to php and…
1
vote
1 answer

Mandatory coupon before checkout in WooCommerce (optional: for specific products)

I want to force the customer to add a coupon code before they can go to checkout. I would like it to work with every coupon code and every product in my WooCommerce store. I am using this code and it is almost solving the problem, but it only works…
1
vote
1 answer

How to add coupons to stripe checkout

i am using stripe on my ruby on rails 5 website for my payment gateway plans. I am using the api in the client-side just as it appears in this link. I need to add a coupon to my plan, I could create it in the stripe dashboard in the testmode like…
1
vote
1 answer

Hide conditionally Cart page coupon field in Woocommerce

I want to hide the coupon field on the cart page for all products except for ones with a specific product category. I created the following code which works but every once in awhile which doesn't seem to be related to time, I get an error message…
David
  • 79
  • 1
  • 6
1
vote
1 answer

Applying conditionally a generated coupon on WooCommerce add to cart

I'm currently using Gravity Forms (with referral as lead enabled). I'm using a hook on submit to generate a random coupon based off of a coupon template (in my functions.php). My goal is to then have that coupon automatically applied to their order…
1
vote
1 answer

Recalculating price in JS after redeeming 20% voucher

Trying to recalculate the final price in JS after applying a discount, but doesn’t seem to work. Total Cart and Redeem Coupon function just fine, but I can’t get the final price. // TOTAL CART obj.totalCart = function () { var totalCart = 0; …
Ezekiel
  • 11
  • 2
1
vote
0 answers

if apply coupon with custom code it will not count in usage in woocommerce

I am using woocommerce on my WordPress site. There is a problem with Coupon usage count, please help me fix it. I saw already many questions in the stack-overflow for my problem, but I did not get a single answer to my need. The image below will…
Bhavik Hirani
  • 1,996
  • 4
  • 28
  • 46
1
vote
1 answer

How to make the "coupon amount" column sortable in WooCommerce

Departing from the following tutorial: "Columns in WooCommerce", the intention is to make the coupon amount column sortable based on amount. Making it sortable seems to be successful with my already written code. Nevertheless, the rule to sort goes…
Jerry
  • 53
  • 6
1
vote
1 answer

How to output the current logged in WooCommerce users coupon usage?

I would like to output for the current logged in user, how many times they have used a specific coupon code. The coupon code "example_coupon" has a maximum "Usage limit per user" of 12. I would like to display on the front end to the user how many…
James_Www
  • 13
  • 2
1
vote
1 answer

Custom Coupon Error on WooCommerce - "Uncaught Error: Call to a member function get_cart() on null..."

I am attempting to create a custom coupon code in WooCommerce using PHP which essentially discounts the price of each item in the cart with the tag name 'main' to 10. It does this by counting the number of items in the cart tagged with 'main', then…
BillyCon
  • 19
  • 2
1
vote
1 answer

WooCommerce - Remove item from cart if specific coupon code or product is not present or removed

I have added a function to add a free product when a certain coupon code is entered. I now need to check if the original product is still in the cart, and if not, remove coupon and free product from the cart. add_action('woocommerce_applied_coupon',…
user13655710
1
vote
1 answer

WooCommerce coupon usage restriction by allowed user roles

we need to make an automatic discount coupon to be applied if the current user role is ( vendor ), we achieved that by creating a normal coupon then used the snippet below to automatic apply the coupon .. but we need to limit the usage of that…
Maged Mohamed
  • 511
  • 5
  • 27
1
vote
1 answer

Hide Free shipping for specific applied coupon when discounted subtotal is below 75

I am trying to create a very specific type of coupon code. If a customer enters "allthings30" they get 30% off. However if the order is over £75, They get free shipping as well. Now the website, already has free shipping in place, but I want those…