Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //add coupon details in order email
- add_action( 'woocommerce_email_after_order_table', 'wc89790_add_coupon_to_email', 20 );
- function wc89790_add_coupon_to_email( $order ) {
- $coupons = $order->get_items('coupon');
- foreach ($coupons as $item_id => $item) {
- $coupon = new WC_Coupon( $item['name'] );
- $post = get_post($coupon->id);
- echo "<p class='coupon-used'><span class='coupon-name'><b>Coupon: " . $item['name'] . "</b></span></p>";
- echo "<p><span class='coupon-description'>" . $post->post_excerpt . "</span></p>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement