Skip to content

Instantly share code, notes, and snippets.

@Attaulla9
Created January 6, 2022 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Attaulla9/b5cc9eb183d53c6f5c2f3a1b31f88995 to your computer and use it in GitHub Desktop.
Save Attaulla9/b5cc9eb183d53c6f5c2f3a1b31f88995 to your computer and use it in GitHub Desktop.
We can get coupon Detain in woocommerce
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