In woocommerce, I am trying to add a fee using this answer code:
Update fee dynamically based on radio buttons in Woocommerce checkout (credits: LoicTheAztec)
I need to update the code to add third conditional option to the fee like "ribbon" in this hooked function:
// Add a custom dynamic packaging fee
add_action( 'woocommerce_cart_calculate_fees', 'add_packaging_fee', 20, 1 );
function add_packaging_fee( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
$packing_fee = WC()->session->get( 'chosen_packing' ); // Dynamic packing fee
$fee = $packing_fee == 'box' ? 9.00 : 3.00;
$cart->add_fee( __( 'Packaging fee', 'woocommerce' ), $fee );
}
But I am stuck trying to add another entry with this line of code:
$fee = $packing_fee == 'box' ? 9.00 : 3.00;
How can I add an additional fee option?