WooCommerce apply discount on product amount based on quantity in cart page

I am trying to achieve below functionality in woo-commerce cart page. In my cart page if quantity between 1-9 need to apply 0.5% discount on product price and than after calculate the line total.Same as Also i need to apply quantity for 10-19,20-49 and assign respectively discount percentage. For the discount percentage i am fetching from option table which i already developed in woo-commerce setting.

if( $cart_item['quantity'] >= 0 && $cart_item['quantity'] <= 9 ){
    $dis_percentage = get_option( 'discount_for_qty_0-9' );
    echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); }

I am changing the code in cart.php file.Can anyone help me to how to apply my filter and get the price with my given discount without affecting the default functionality.

Related posts