Last active
July 9, 2021 06:09
-
-
Save Balakrishnan-flycart/0dda2afa3e952901ce05d785e36d64f6 to your computer and use it in GitHub Desktop.
Woo Discount Rules v2 - get discount details for order object
This file contains hidden or 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
$items = $order->get_items(); //order object | |
if (!empty($items) && class_exists('\Wdr\App\Controllers\ManageDiscount')) { | |
$manage_discount = new \Wdr\App\Controllers\ManageDiscount (); //Create new object | |
foreach ($items as $key => $item) { //loop | |
$discount_details = $item->get_meta('_advanced_woo_discount_item_total_discount');// Discount Details | |
if (!empty($discount_details)) { | |
$discount = $manage_discount->getDiscountPerItem($discount_details); //Discount | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment