x
23
23
1
add_action('woocommerce_before_cart_totals', 'apply_product_on_coupon');
2
function apply_product_on_coupon() {
3
global $woocommerce;
4
5
if ( ! empty( $woocommerce->cart->applied_coupons ) ) {
6
$my_coupon = $woocommerce->cart->get_coupons() ;
7
foreach($my_coupon as $coupon){
8
9
if ( $post = get_post( $coupon->id ) ) {
10
if ( !empty( $post->post_excerpt ) ) {
11
echo "
12
13
".$coupon->code."";
14
echo "
15
".$post->post_excerpt."
16
17
";
18
}
19
}
20
}
21
}
22
}
23