Hide trailing zeros on prices
In file functions.php file add next code:
1 | add_filter( 'woocommerce_price_trim_zeros', '__return_true' ); |
In file functions.php file add next code:
1 | add_filter( 'woocommerce_price_trim_zeros', '__return_true' ); |
From WOOCS version 2.3.1/1.3.1 it is possible with 2 next hooks: woocs_announce_aggregator and woocs_add_aggregator_processor in file functions.php of the current wordpress theme. Example:
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 | add_action('woocs_announce_aggregator', function($aggregators) { $aggregators['hello_world'] = 'My own aggregator'; return $aggregators; }); add_action('woocs_add_aggregator_processor', function($aggregator_key, $currency_name) { global $WOOCS; $request = []; //ratesapi.io as an example //see more examples in file \classes\woocs_after_33.php in public function get_rate() if ($aggregator_key === 'hello_world') { $query_url = 'https://api.ratesapi.io/api/latest?base=' . $WOOCS->default_currency . '&symbols=' . $currency_name; if (function_exists('curl_init')) { $res = $WOOCS->file_get_contents_curl($query_url); } else { $res = file_get_contents($query_url); } $data = json_decode($res, true); $request = isset($data['rates'][$currency_name]) ? $data['rates'][$currency_name] : 0; if (!$request) { $request = sprintf("no data for %s", $currency_name); } } return $request; }, 10, 2); |
WOOCS functionality allows realize Price Based on Country using its own functionality, for this you need: in tab Advanced set for ‘Is multiple allowed’ -> ‘Yes’ press Save button enable ‘Checkout by GeoIP rules’ enable ‘Individual GeoIP rules for each product(*)’ set GeoIP rules in its tab In each product set prices you prefer for each […]
Open your current wp theme functions.php file and drop there next code:
1 2 3 | add_filter('woocs_raw_woocommerce_price', function($price) { return round($price + 0.01) – 0.01; }); |
Read also: https://currency-switcher.com/hook/woocs_raw_woocommerce_price/ Origin: https://wordpress.org/support/topic/round-price-xx-99/
Read info about it here: https://pluginus.net/make-auto-update-wordpress-plugins-themes-bought-envato/
press CTRL+R CTRL+F5 Ctrl+Shift+R Apple + R or command + R (apple) in Chrome browser the best way is: Open the developer tools: Ctrl + Shift + I Now, leaving the panel open, left click on the “Update” button (next to the address line) and do not release the button. After a few seconds, you […]
Yes, in the functions.php file of the current wp theme of the site add the next code:
1 2 3 4 5 6 7 8 9 10 11 12 | add_action('woocommerce_checkout_update_order_review', function($data) { global $WOOCS; if (is_string($data)) { parse_str($data, $data); } //*** $_currency = $WOOCS->get_currency_by_country($data['shipping_country']); if (!empty($_currency)) { $WOOCS->set_currency($_currency); } }, 9999); |
Do not forget to set in tab “GeoIP rules” currency rules for countries as that rules uses in the billing on the script above Customer request: Is it possible that Delivercountry change the Curreny? Deliver to […]
Original: https://wordpress.org/support/topic/where-to-find-what-currency-was-used-for-payment-in-database DB Table: wp_postmeta Key: _order_currency Code:
1 | <?php $order_currency = get_post_meta($post_id, '_order_currency', true); ?> |
Request from the customer: Basically, add a column to the existing table, with a dropdown that shows “all countries” by default OR “selected countries” comma delimited this way, I can accept Euro only in Euro countries and USD in others. This will affect the currency dropdown – in case that the current GEO supports one currency, […]
WooCommerce Currency Switcher cant by default work with WooCommerce reports as there is no hooks there, and its not possible to plug-in there. But after some investigations of woocommerce code I found 1 way how to adapt reports for orders with different currencies (works only for Reports->Orders->”Sales by date”): open file wp-content\plugins\woocommerce\includes\admin\reports\class-wc-admin-report.php find there public […]