| 1 |
<?php |
| 2 |
|
| 3 |
// Set Cart Items discounts. |
| 4 |
use Disco\App\Disco; |
| 5 |
|
| 6 |
if ( ! function_exists( 'disco_set_cart_item_price_test' ) ) { |
| 7 |
|
| 8 |
/** |
| 9 |
* Set Cart Items discounts. |
| 10 |
* |
| 11 |
* @param object $cart Cart object. |
| 12 |
* @return object |
| 13 |
* @throws \Exception Error message. |
| 14 |
*/ |
| 15 |
function disco_set_cart_item_price_test( $cart ) { |
| 16 |
return ( new Disco )->get_cart_items_discount( $cart ); |
| 17 |
} |
| 18 |
|
| 19 |
add_action( 'woocommerce_before_calculate_totals', 'disco_set_cart_item_price_test', 1, 1 ); |
| 20 |
} |
| 21 |
|