// 1. Add the Choice to Checkout add_action('woocommerce_review_order_before_submit','add_checkout_payment_choice');function add_checkout_payment_choice(){echo '<div id="checkout-payment-type" style="margin-bottom:20px; padding:15px; background:#f9f9f9; border:1px solid #eee;">
            <p><strong>Payment Option:</strong></p>
            <label><input type="radio" name="payment_choice" value="full" checked> Pay Full Amount (Get 2% OFF)</label><br>
            <label><input type="radio" name="payment_choice" value="deposit"> Pay 10% Deposit</label>
          </div>'}// 2. Apply the 2% Discount ONLY if "Full" is selected add_action('woocommerce_cart_calculate_fees','apply_checkout_discount_logic',99);function apply_checkout_discount_logic($cart){if (is_admin() && ! defined('DOING_AJAX')) return;// Check what the user clicked at checkout $chosen_payment=isset($_POST['post_data']) ? $_POST['post_data'] :'';parse_str($chosen_payment,$post_data);$payment_type=isset($post_data['payment_choice']) ? $post_data['payment_choice'] :'full';if ($payment_type=='full'){$discount=$cart->subtotal * .02;$cart->add_fee('2% Discount on Full Payment',-$discount)}}