Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Balakrishnan-flycart/0dda2afa3e952901ce05d785e36d64f6 to your computer and use it in GitHub Desktop.
Save Balakrishnan-flycart/0dda2afa3e952901ce05d785e36d64f6 to your computer and use it in GitHub Desktop.
Woo Discount Rules v2 - get discount details for order object
$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