Hi,
What’s your plugin setup? to which payment methods are added and how do you count the fee? I’m guessing, that you add a fee that is based on the total price and then you change it with rounding? Anything in the console throwing an error?
You might as well check to add a later priority to the filter add_filter( 'woocommerce_calculated_total', 'my_custom_roundoff', 1001 );
If not, could you spin up a tastewp.com site or another sandbox with simple WooCommerce and my plugin installed, reproduce the error (with Code Snippets) and invite me? I’ll have a look.
P.S. I would guess that adding the rounding as a fee (+ or -) would be a better way to achieve a rounded price (and more clear from the accounting view).
Best regards,
Karolina
Thread Starter
Azragh
(@azragh)
Plugin Setup: Invoice Gateway For WooCommerce, Refer A Friend für WooCommerce,
Search By SKU, VarkTech Pricing Deals, WooCommerce Google Analytics Integration, WooCommerce Google Feed Manager, WooCommerce PayPal Payments, WooCommerce UPC, EAN, and ISBN and WooCommerce wallee.
Available Payment methods are Twint, Credit Card, PostFinance Card, PostFinance E-Finance, PayPal and Invoice. Yes our client charges a 2.4% fee on the total amount of the cart (but only for credit- and debit cards, Mastercard and PayPal). Console shows no errors or warnings. Later Priority added, but didn’t work.
We tried to configure the plugin on the old shop of same client. There we get the error even without the rounding stuff (benke.ch/webalt). On this site we left it active as it’s only there for referencing old content atm so you could at least watch the behaviour.
However, since the error on the new page exists only with the rounding function, and the customer would agree with rounding the fees alone, your suggestion would be a good solution.
Can this be set in the plugin, or is there a special function for this?
Thread Starter
Azragh
(@azragh)
Thanks for leading into the right direction!
We got it to work with this one:
function my_pay4pay_amount( $amount, $calculation_base, $current_payment_gateway, $taxable, $include_taxes, $tax_class ) {
$round_num = round($amount / 0.05) * 0.05;
$amount = number_format($round_num, 2);
return $amount;
}
add_filter( "woocommerce_pay4pay_wallee_1_amount", 'my_pay4pay_amount' , 10 , 6 );
add_filter( "woocommerce_pay4pay_ppcp-gateway_amount", 'my_pay4pay_amount' , 10 , 6 );
The problem was caused by the plugin “wallee”, which registered his own names for credit card payments – “walle_1” replaces “cod” and so on.
Hi @azragh,
I’m glad that you sorted it out 🙂 If you like my help and the plugin, I would really appreciate a review (and eventually a donation for development if it saves you money and time).
Have a nice weekend!
Karolina