I would like to add a fee on the total purchase in Woocommerce after the user chooses the number of parcels on the card greater than 6. Is this correct my line of thinking?
<?php
$parcelas = $_GET['installment'];
globals $woocommerce;
if ( $parcelas == $number > 6 ) { add_action(
'woocommerce_cart_calculate_fees', 'custom_fee_based_on_cart_total', 10, 1 );
function custom_fee_based_on_cart_total( $cart_object ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
// The cart total
$cart_total = strip_tags( wc_price( $installment['installment_amount'] / 100
* 1.0526 ) ) ;
if ( $fee != 0 )
$cart_object->add_fee( __( "Gratuity", "woocommerce" ), $fee, false );
} ;} ?>
<?php endforeach; ?>
</select>