Created
January 6, 2022 13:55
-
-
Save Attaulla9/b5cc9eb183d53c6f5c2f3a1b31f88995 to your computer and use it in GitHub Desktop.
We can get coupon Detain in woocommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (function_exists('get_field')) { | |
$poss_coupon_code = get_field( "global_coupon", 35445 ); | |
if($poss_coupon_code) { | |
global $woocommerce; | |
$coupon_object = new WC_Coupon($poss_coupon_code); | |
if($coupon_object->get_discount_type() == "percent") { | |
$discounted_coupon_amount = $coupon_object->get_amount(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment