Disable PayPal currency validation
-
I’m using a custom currency (CRC = Costa Rican Colon) and I can set Paypal to work with it using this code on functions.php:
add_filter( 'woocommerce_currencies', 'add_CRC_currency' ); function add_CRC_currency( $currencies ) { $currencies['CRC'] = __( 'Costa Rican Colon', 'woocommerce' ); return $currencies; } add_filter('woocommerce_currency_symbol', 'add_CRC_currency_symbol', 10, 2); function add_CRC_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'CRC': $currency_symbol = '¢'; break; } return $currency_symbol; } add_filter('woocommerce_paypal_args', 'convert_CRC_to_USD'); function convert_CRC_to_USD($paypal_args){ if ( $paypal_args['currency_code'] == 'CRC'){ $convert_rate = 520; //set the converting rate $paypal_args['currency_code'] = 'USD'; //change CRC to USD $i = 1; while (isset($paypal_args['amount_' . $i])) { $paypal_args['amount_' . $i] = round( $paypal_args['amount_' . $i] / $convert_rate, 2); ++$i; } } return $paypal_args; }But after the payment, Woocommerce gave me this error, and the product stock wasn’t updated:
“Validation error: PayPal amounts do not match (USD). Order status changed from pending to on-hold.”
My question is… how can I disable this validation? to make the product stock works with PayPal payments.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Disable PayPal currency validation’ is closed to new replies.