Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement display of the coupons used in order #3167

Closed
coenjacobs opened this issue May 14, 2013 · 10 comments
Closed

Implement display of the coupons used in order #3167

coenjacobs opened this issue May 14, 2013 · 10 comments
Assignees

Comments

@coenjacobs
Copy link
Contributor

Will show used coupons as line items in the order (on checkout and beyond).

Branch: https://github.com/woothemes/woocommerce/tree/Coupon-display

@atomicsoup
Copy link

Where is the solution to this? as the link is not working?

@brandonecarr
Copy link

Will this add the coupon code used in the admin email/customer order received email?

Thanks!

@jfurner-sebo
Copy link

Is there an update on this, since the link is still not working? Or is there an estimate for the release of WooCommerce 2.1? I have many clients who have been asking about the disappearance of this feature for some time and I'd like to be able to provide a solution.

@coenjacobs
Copy link
Contributor Author

This has been merged into the master branch. We're aiming to have the first beta of v2.1 out by the end of this month, early December the latest. More information on this soon.

@markcy
Copy link

markcy commented Nov 13, 2015

Is this available in master yet? It's been a while.

@johnvic
Copy link

johnvic commented Oct 6, 2016

As for my situation, I updated the file woocommerce/includes/abstracts/abstract-wc-order.php and replaced a part of the function get_order_item_totals

if ( $this->get_total_discount() > 0 ) { $coupons_str=''; if( $this->get_used_coupons() ) { $coupons_str.=' ('; foreach( $this->get_used_coupons() as $coupon) { $coupons_str.= $coupon.','; } $coupons_str=substr($coupons_str, 0, -1); $coupons_str.=')'; } $total_rows['discount'] = array( 'label' => __( 'Discount:', 'woocommerce' ), 'value' => '-' . $this->get_discount_to_display( $tax_display ) . $coupons_str ); }

I know this is not the best way to do it but I hope this functionality will be added to woocommerce new release. If someone could help me to put this on functions.php in theme instead of updating a core file, so an update in the plugin will not affect it. It will be greatly appreciated.
By the way I have woocommerce version 2.4.12

thanks

@WallDenn
Copy link

WallDenn commented May 3, 2017

I used fillter "woocommerce_get_order_item_totals".
add_filter('woocommerce_get_order_item_totals','change_discount',10,3); function change_discount($total_rows, $order, $tax_display){ if ( $order->get_total_discount() > 0 ) { $coupons = $order->get_used_coupons(); $total_rows['discount'] = array( 'label' => __( 'Coupon code: '.implode(",",$coupons), 'woocommerce' ), 'value' => '-' . $order->get_discount_to_display( $tax_display ), ); } return $total_rows; }

@tiagoangelo
Copy link

tiagoangelo commented Jun 7, 2017

@WallDenn , thanks for your tip!
And if I want to show coupon_amount instead of coupon_code?
For account, its better get percentage of discount instead the name of the discount...

@surbhi290391
Copy link

@WallDenn Thanks a lot, my problem is resolved by this code. Thanks a lot.

@surbhi290391
Copy link

Can anyone let me know how to call Amazon Lex functionality in my custom plugin? Please let me know its urgent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants