Answer the question
In order to leave comments, you need to log in
How to make an extra charge for payment by card?
Good afternoon! Woocommerce is installed, standard "By bank" and via paypal are included for payment. The question is - how best to implement the following - automatic "margin" for paying by paypal? For example, if you choose this payment method, then an extra charge of 100 rubles or 3 percent of the order amount is immediately added, for example?
Thanks
Answer the question
In order to leave comments, you need to log in
100 rubles - so
add_filter( 'woocommerce_cart_calculate_fees', 'add_my_fee', 10, 1 );
function add_my_fee() {
$gateway = WC()->session->get( 'chosen_payment_method' );
if ( $gateway == 'paypal' ) {
WC()->cart->add_fee( 'Наценка за метод оплаты который нам не нравится', 100 );
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question