How to apply an additional fee for the layaway payment

You’re using the Payment Method Checkout Fee plugin. This looks like it’s relatively simple, just a woocommerce_cart_calculate_fees hook and some code to configure it.

https://plugins.svn.wordpress.org/payment-method-checkout-fee-for-woocommerce/trunk/checkoutfee.php

You didn’t say what you’re using to implement layaways but since this doesn’t work I’m guessing it’s treated as a separate payment gateway internally, i.e. when you have a layaway you no longer get chosen_payment_method = paypal. You’ll need to

  1. work out what the PayPal-with-layaway gateway is called. You can do this by e.g. adding an error_log() to checkoutfee.php:
    // Check if WooCommerce is enabled before executing the function
    function pmcf_payment_method_checkout_fee() {
        if (class_exists('WooCommerce')) {
            $payment_method = WC()->session->get('chosen_payment_method');
            error_log( '$payment_method = "' . $payment_method . '"' );
    

    then set up a layaway basket on your site and check your server error log (or PHP error log if different, or WordPress debug log) for the payment method.

  1. add this as a new gateway to both places where the plugin calls get_available_payment_gateways(). e.g. if you got $payment_method = "paypal-with-layaway" in your logs from step 1 you’d want
    $gateways = WC()->payment_gateways->get_available_payment_gateways();
    $gateways[] = 'paypal-with-layaway';
    

    in the plugin’s checkoutfee.php and admin/main.php.

  2. remove the error log in step 1.

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino