-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.php
45 lines (38 loc) · 1.51 KB
/
action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
add_action('plugins_loaded', function () {
if (class_exists('WC_Payment_Gateway')) {
// Registers class WC_Guaranteed_Sama as a payment method.
add_filter('woocommerce_payment_gateways', function ($methods) {
$methods[] = 'WC_GSama';
return $methods;
});
// Allows the gateway to define some currencies.
add_filter('woocommerce_currencies', function ($currencies) {
$currencies['IRR'] = 'ریال';
$currencies['IRT'] = 'تومان';
$currencies['IRHR'] = 'هزار ریال';
$currencies['IRHT'] = 'هزار تومان';
return $currencies;
});
// Allows the gateway to define some currency symbols for the defined currency coeds.
add_filter('woocommerce_currency_symbol', function ($currency_symbol, $currency) {
switch ($currency) {
case 'IRR':
$currency_symbol = 'ریال';
break;
case 'IRT':
$currency_symbol = 'تومان';
break;
case 'IRHR':
$currency_symbol = 'هزار ریال';
break;
case 'IRHT':
$currency_symbol = 'هزار تومان';
break;
}
return $currency_symbol;
}, 10, 2);
// Required Gateway Class
require_once WOO_GSAMA_GATEWAY_DIR.'class-gateway.php';
}
}, 0);