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!
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); } //... }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Getting Cart Values’ is closed to new replies.