Title: Getting Cart Values
Last modified: June 21, 2023

---

# Getting Cart Values

 *  Resolved [Marius Schulte](https://wordpress.org/support/users/mariusiscoding/)
 * (@mariusiscoding)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/getting-cart-values/)
 * I have the following Code but the output of the hooks is not what I think it 
   should be.
   The **discount_price** is outputting 0 and **save_amount** outputting
   1.I want have some custom coupon validations going on and need the discounted
   price for that.
 * Thanks for helping out!
 *     ```wp-block-code
       add_filter('woocommerce_coupon_is_valid', 'custom_coupon_validation', 10, 2);
       function custom_coupon_validation($is_valid, $coupon)
       {
           $cart = WC()->cart;
           $cart_items = $cart->get_cart();
   
           foreach ($cart_items as $cart_item_key => $cart_item) {	
   
               //these ones are not outputing the right results in my case
       	$discount_price = apply_filters('advanced_woo_discount_rules_get_cart_item_discount_price', false, $cart_item);
   
       	$save_amount = apply_filters('advanced_woo_discount_rules_get_cart_item_saved_amount', false, $cart_item);
   
       	//Debug Output:
               throw new Exception(__('Discount: '.$save_amount, 'woocommerce'), 100);
               //also using print_r outputs 0
               throw new Exception(__('Test' . print_r($discount_price), 'woocommerce'), 100);
   
           }
           //...
       }
       ```
   
    -  This topic was modified 2 years, 9 months ago by [Marius Schulte](https://wordpress.org/support/users/mariusiscoding/).

Viewing 1 replies (of 1 total)

 *  [sangeethasrinivasan](https://wordpress.org/support/users/sangeethasrinivasan/)
 * (@sangeethasrinivasan)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/getting-cart-values/#post-16839121)
 * Hi,
 * Thank you for reaching out.
 * We had a check in our local with the given code and it seems discount_price and
   save_amount is outputting correctly in cart.
 * To assist you further, we kindly request that you open a support ticket at the
   following link: [https://www.flycart.org/support](https://www.flycart.org/support)
   with the below details:
    - Version of Discount Rules for Woocommerce plugin you are using
    - Screenshots of discount rules you have configured
    - Screenshots of woocommerce coupon configuration
    - Cart page screenshot indicating the issue
    - Site URL
 * So that our dedicated support engineers will promptly provide you with solutions
   by reproducing the same in our local.
 * We greatly appreciate your cooperation.
 * Thanks
 * Team Flycart

Viewing 1 replies (of 1 total)

The topic ‘Getting Cart Values’ is closed to new replies.

 * ![](https://ps.w.org/woo-discount-rules/assets/icon-256x256.png?rev=1977982)
 * [Discount Rules for WooCommerce](https://wordpress.org/plugins/woo-discount-rules/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-discount-rules/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-discount-rules/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-discount-rules/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-discount-rules/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-discount-rules/reviews/)

## Tags

 * [discount](https://wordpress.org/support/topic-tag/discount/)
 * [price](https://wordpress.org/support/topic-tag/price/)

 * 1 reply
 * 2 participants
 * Last reply from: [sangeethasrinivasan](https://wordpress.org/support/users/sangeethasrinivasan/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/getting-cart-values/#post-16839121)
 * Status: resolved