Instructions to activate PayPal payment gateway for VND on WooCommerce in a simple way.
If you don’t know, Vietnam Dong (VND) is not an officially supported currency by PayPal. Therefore, in WooCommerce, if you set the currency to VND, you will not be able to activate the PayPal Standard payment gateway. To solve this situation, we need to convert VND to another currency supported by PayPal, such as USD. In today’s article, I will show you how to activate the PayPal payment gateway for VND in the simplest way.
Enable PayPal payment for VND
There are 2 different ways to do this: using code (manually) or using a plugin (automatically).
Using code (manually)
1. First, you need to insert the following code into the file
functions.php of the theme you are using. You can also insert it via plugin Code Snippets to avoid the code being deleted when upgrading the theme.
Note: in line 24, you can replace
20000 with the appropriate exchange rate. In the code above, we let the exchange rate $1 = 20000 VND.
2. Access WooCommerce => Settings => General => drag down area Currency options and set as shown below.
- Currency: currency unit.
- Currency position: display position of the currency.
- Thousand separator: thousandth separator. In Vietnam, we use comma (.) instead of comma (,).
- Decimal separator: decimal separator. In Vietnam, we use dot (,) instead of period (.).
- Number of decimals: the number of digits after the decimal separator. We leave it at 0 because there is currently no unit less than 1 VND in VND.
3. Switch to tab Paymentsyou will see that the PayPal payment gateway has been activated and now you can click on the . button Manage to proceed to establish information.
If you do not see the PayPal Standard payment gateway, you can refer to the article: “Activating PayPal Standard on WooCommerce”.
Using plugins (automatically)
The advantage of this method is that it is very simple and you do not need to edit the code every time you update WooCommerce.
1. First, you need to install and activate a plugin called Payment Gateway Currency for WooCommerce (download).
2. Next, visit WooCommerce => Settings => Payment Gateway Currency => Convert Currency => Set up port PayPal Standard as shown below.
- Enable section: you tick to activate the currency conversion feature.
- Convert currency: select a currency supported by PayPal, specifically USD here.
- Conversion rate: conversion rate. For example, I let $1 = 20000 VND, so the exchange rate will be 1/20000 = 0.00005. Note: the decimal separator here is a period (.), not a comma (,).
- Currency symbol: symbol of the currency unit. In this case, it’s USD, so I let
Click the button Save Changes to save.
3. Do the same steps 2 and 3 of the manual method.
Order not auto-complete error handling
As for the manual method (using code), there is one problem we need to solve that is the order does not complete automatically, even if the customer has made a successful payment and the money has been returned to the PayPal wallet of the customer. Friend. This means that you will have to confirm order completion manually, which is really inconvenient, especially when you sell digital products (customers can’t download products immediately after paying without paying). must wait for your approval).
To fix this situation, you need to access the host through the File Manager of cPanel / DirectAdmin or FTP software, find the path
/wp-content/plugins/woocommerce/includes/gateways/paypal/includes and open the file
class-wc-gateway-paypal-ipn-handler.php out. Find the following 2 lines of code:
And change it to:
to disable them. You will have to repeat this work every time you upgrade WooCommerce to a new version, a bit inconvenient but currently there is no better automatic solution. If you use a plugin, you don’t need to care about it.
Finally, try to place an order and check the results. Not too complicated, right? Good luck!
Are you using PayPal for VND payment gateway on your WooCommerce website? What method did you use to do that? Do share it with us in the comment box below.
If you liked this article, please subscribe to my blog to regularly update the best and latest articles via email. Thanks very much. 🙂