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

Change "[Remove]" link text to an icon for coupon in WooCommerce checkout

I would like to change the "[Remove]" link text to an icon for coupons in WooCommerce checkout page. Instead of "[Remove]" I would like it to be a trash can icon from Font Awesome. I have found 2 code snippets to change the text: function…
JOKKER
  • 502
  • 6
  • 21
2
votes
1 answer

Remove columns from WooCommerce admin coupon list

I am trying to remove some default columns (amount & products) from the WooCommerce admin coupon list. For that I make use of the following code: add_filter( 'manage_posts_columns', 'custom_post_columns', 10, 2 ); function custom_post_columns(…
Joy Zalte
  • 91
  • 10
2
votes
1 answer

Add a custom column to WooCommerce admin coupon list

Yesterday we had the situation, that someone ask my "Who created this coupon?". Unfortunately WooCommerce by default does not display the creator of the coupon in the coupon overview where all coupon are listed. What I try to find out is, how can I…
Nik7
  • 346
  • 2
  • 16
2
votes
1 answer

Check if coupon is applied in WooCommerce using coupon shortcode form

I have a shortcode (which works fine) that applies coupons and it does so using custom messages. Everything works fine except for one thing: if a coupon is applied and the user makes the "mistake" of trying to apply it again - it gives the error…
user14906105
2
votes
1 answer

Change "Remove" link text for WooCommerce coupon on checkout page

Instead of [Remove] on the WooCommerce checkout for added coupons, I would like the text to be [Remove & Re-Calculate]. I am using the following and the text is changed but there is no link (the coupon cannot be removed). This is what I…
user14817151
2
votes
1 answer

Woocommerce - update_order_review become 502 after add_discount programmatically

I need some help. I want to implement, add existing coupon to cart when some conditions are fulfilled. I've got nothing wrong with the condition. But, when the function are going to add discount to coupon, the wc-ajax=update_order_review become…
2
votes
1 answer

Do not apply coupon discount on backorder products in WooCommerce

I'm trying to apply a coupon only on products that are on stock. So if i have 5 items on cart and 4 in stock, just 4 will have the discount applied, the products on backorder WILL NOT. Actually I'm trying to change the default…
2
votes
2 answers

WooCommerce: Change remove coupon link in cart

I want to change the remove coupon link in the cart. At the moment it's the word Remove in brackets: [Remove]. I found the function wc_cart_totals_coupon_html in the cart-totals.php template. And I also found the link inside that…
Cray
  • 5,307
  • 11
  • 70
  • 166
2
votes
1 answer

Creating a List of Available WooCommerce Coupon Codes and Display anywhere Using Shortcode

I am trying to generate a list of available coupons and to display them using a shortcode. I was hoping to generate the list using SQL and not "-1" since that's heavier on the db from what I understand. The error I get is this: Notice: Array to…
user13639445
2
votes
2 answers

Add restriction to WooCommerce coupons by allowed user ID

Let's say i'm using this code to create a coupon: $coupon_code = 'CODEOFF'; $amount = '10'; $discount_type = 'percent'; $coupon = array( 'post_title' => $coupon_code, 'post_status' => 'publish', 'post_author' => 1, …
2
votes
2 answers

Display used coupon(s) in WooCommerce order email notifications

I have a code that displays an used coupon: add_action( 'woocommerce_email_after_order_table', 'add_payment_method_to_admin_new_order', 15, 2 ); function add_payment_method_to_admin_new_order( $order, $is_admin_email ) { if(…
2
votes
1 answer

Stripe Plan Pricing with Coupon Applied without charging the customer

I am trying to figure out how I can get the final total amount from Stripe for a subscription plan with a coupon applied, without charging the customer to show in the confirmation page before checkout. I see there is API in Stripe to get Plan info…
Encore PTL
  • 8,084
  • 10
  • 43
  • 78
2
votes
2 answers

Hide specific shipping methods when coupon is applied

I have created a coupon code "Tiendas" for double x2 shipping price and disable free default store shipping (orders > 50€). Also, the coupon enables free shipping but increase order value to >250€. I have 3 shipping methods on my…
2
votes
1 answer

WooCoomerce WC_Abstract_Order::get_coupon_codes PHP Fatal Error

I'm trying to use new WC_Abstract_Order::get_coupon_codes() methods to get coupon codes in an order. This was the previous working snippet: $coupons = $order->get_used_coupons(); $nCoupons = count($coupons); if($nCoupons == 1) …
Davide Iandoli
  • 99
  • 3
  • 13
2
votes
1 answer

How to Update Coupon Code Objects in Woocommerce

How to Update Coupon Code Objects in Woocommerce (Wordpress). $beforeadduseremail="test@gmail.com"; update_post_meta( 21, 'email_restrictions', $beforeadduseremail);
Karthik
  • 5,589
  • 18
  • 46
  • 78