Version Description
- 19/02/2018 =
- Fix - PRICES & CURRENCIES - Currency Exchange Rates - Crons - "Undefined index..." notices in log fixed.
- Dev - PRICES & CURRENCIES - Currency Exchange Rates - "Exchange Rates Offset (Percent)" options added for each currency pair.
- Dev - PRICES & CURRENCIES - Currency Exchange Rates - "Update all rates now" button added.
- Fix - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - Session init moved to the
init
hook (on "WC Sessions"). - Fix - PRICES & CURRENCIES - Prices and Currencies by Country - Session init moved to the
init
hook (on "WC Sessions"). - Dev - PRODUCTS - Product Listings - Admin Settings - Descriptions updated.
- Dev - PRODUCTS - Product Tabs - "Content Processing" option added.
- Dev - EMAILS & MISC. - General - "Session Type in Booster" option re-enabled.
- Dev - Speed Optimization - "WC Sessions" is now the default option for
WCJ_SESSION_TYPE
. Affected modules: Checkout Files Upload, EU VAT Number, Multicurrency (Currency Switcher), Product Visibility by Country, Product Custom Visibility, Tax Display, Prices and Currencies by Country. - Dev - Code refactoring - Replaced some code with
wcj_is_frontend()
.
Download this release
Release Info
Developer | algoritmika |
Plugin | Booster for WooCommerce |
Version | 3.4.5 |
Comparing to | |
See all releases |
Code changes from version 3.4.4 to 3.4.5
- includes/admin/class-wcj-settings-custom-fields.php +4 -3
- includes/class-wcj-currency-exchange-rates.php +60 -6
- includes/class-wcj-currency-per-product.php +15 -18
- includes/class-wcj-general.php +1 -1
- includes/class-wcj-global-discount.php +1 -1
- includes/class-wcj-multicurrency-product-base-price.php +1 -1
- includes/class-wcj-multicurrency.php +32 -17
- includes/class-wcj-price-by-country.php +1 -1
- includes/class-wcj-price-by-user-role.php +1 -1
- includes/class-wcj-product-addons.php +1 -1
- includes/class-wcj-product-bookings.php +1 -1
- includes/class-wcj-product-by-country.php +1 -1
- includes/class-wcj-product-by-user-role.php +1 -1
- includes/class-wcj-product-custom-visibility.php +1 -1
- includes/class-wcj-product-tabs.php +22 -5
- includes/core/wcj-constants.php +13 -5
- includes/exchange-rates/class-wcj-exchange-rates-crons.php +8 -9
- includes/functions/wcj-functions-exchange-rates.php +17 -1
- includes/price-by-country/class-wcj-price-by-country-core.php +17 -14
- includes/settings/wcj-settings-currency-exchange-rates.php +6 -4
- includes/settings/wcj-settings-general.php +3 -3
- includes/settings/wcj-settings-product-listings.php +9 -9
- includes/settings/wcj-settings-product-tabs.php +22 -2
- readme.txt +13 -1
- woocommerce-jetpack.php +2 -2
includes/admin/class-wcj-settings-custom-fields.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Settings Custom Fields
|
4 |
*
|
5 |
-
* @version 3.
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
@@ -36,7 +36,7 @@ class WCJ_Settings_Custom_Fields {
|
|
36 |
/**
|
37 |
* output_exchange_rate_settings_button.
|
38 |
*
|
39 |
-
* @version 3.
|
40 |
*/
|
41 |
function output_exchange_rate_settings_button( $value ) {
|
42 |
|
@@ -62,7 +62,8 @@ class WCJ_Settings_Custom_Fields {
|
|
62 |
$tip = '';
|
63 |
$description = '';
|
64 |
$exchange_rate_server = wcj_get_currency_exchange_rate_server_name( $value['custom_attributes_button']['currency_from'], $value['custom_attributes_button']['currency_to'] );
|
65 |
-
$value_title = sprintf( __( 'Grab %s rate from %s', 'woocommerce-jetpack' ), $value['value'], $exchange_rate_server )
|
|
|
66 |
?>
|
67 |
<tr valign="top">
|
68 |
<th scope="row" class="titledesc">
|
2 |
/**
|
3 |
* Booster for WooCommerce - Settings Custom Fields
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
36 |
/**
|
37 |
* output_exchange_rate_settings_button.
|
38 |
*
|
39 |
+
* @version 3.4.5
|
40 |
*/
|
41 |
function output_exchange_rate_settings_button( $value ) {
|
42 |
|
62 |
$tip = '';
|
63 |
$description = '';
|
64 |
$exchange_rate_server = wcj_get_currency_exchange_rate_server_name( $value['custom_attributes_button']['currency_from'], $value['custom_attributes_button']['currency_to'] );
|
65 |
+
$value_title = sprintf( __( 'Grab raw %s rate from %s.', 'woocommerce-jetpack' ), $value['value'], $exchange_rate_server ) .
|
66 |
+
' ' . __( 'Doesn\'t apply rounding, offset etc.', 'woocommerce-jetpack' );
|
67 |
?>
|
68 |
<tr valign="top">
|
69 |
<th scope="row" class="titledesc">
|
includes/class-wcj-currency-exchange-rates.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Module - Currency Exchange Rates
|
4 |
*
|
5 |
-
* @version 3.
|
6 |
* @since 2.3.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
@@ -16,7 +16,7 @@ class WCJ_Currency_Exchange_Rates extends WCJ_Module {
|
|
16 |
/**
|
17 |
* Constructor.
|
18 |
*
|
19 |
-
* @version
|
20 |
*/
|
21 |
function __construct() {
|
22 |
|
@@ -31,10 +31,24 @@ class WCJ_Currency_Exchange_Rates extends WCJ_Module {
|
|
31 |
|
32 |
if ( $this->is_enabled() ) {
|
33 |
include_once( 'exchange-rates/class-wcj-exchange-rates-crons.php' );
|
|
|
34 |
}
|
35 |
include_once( 'exchange-rates/class-wcj-exchange-rates.php' );
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/**
|
39 |
* wcj_ajax_get_exchange_rates.
|
40 |
*
|
@@ -177,25 +191,65 @@ class WCJ_Currency_Exchange_Rates extends WCJ_Module {
|
|
177 |
return $settings;
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
/**
|
181 |
* get_all_currencies_exchange_rates_settings.
|
182 |
*
|
183 |
-
* @version 3.
|
184 |
* @since 2.9.0
|
185 |
*/
|
186 |
-
function get_all_currencies_exchange_rates_settings( $
|
187 |
-
if ( $
|
|
|
188 |
$exchange_rate_servers = wcj_get_currency_exchange_rate_servers();
|
189 |
$exchange_rate_server = get_option( 'wcj_currency_exchange_rates_server', 'ecb' );
|
190 |
$default_server = ( isset( $exchange_rate_servers[ $exchange_rate_server ] ) ? $exchange_rate_servers[ $exchange_rate_server ] : $exchange_rate_server );
|
|
|
|
|
191 |
}
|
192 |
$settings = array();
|
193 |
$currency_from = get_option( 'woocommerce_currency' );
|
194 |
$currencies = $this->get_all_currencies_exchange_rates_currencies();
|
195 |
foreach ( $currencies as $currency ) {
|
196 |
$settings = $this->add_currency_pair_setting( $currency_from, $currency, $settings );
|
197 |
-
if ( $
|
198 |
$settings = $this->add_currency_pair_server_setting( $currency_from, $currency, $default_server, $settings );
|
|
|
199 |
}
|
200 |
}
|
201 |
return $settings;
|
2 |
/**
|
3 |
* Booster for WooCommerce - Module - Currency Exchange Rates
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.3.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
16 |
/**
|
17 |
* Constructor.
|
18 |
*
|
19 |
+
* @version 3.4.5
|
20 |
*/
|
21 |
function __construct() {
|
22 |
|
31 |
|
32 |
if ( $this->is_enabled() ) {
|
33 |
include_once( 'exchange-rates/class-wcj-exchange-rates-crons.php' );
|
34 |
+
add_action( 'admin_init', array( $this, 'maybe_update_all_rates' ) );
|
35 |
}
|
36 |
include_once( 'exchange-rates/class-wcj-exchange-rates.php' );
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* maybe_update_all_rates.
|
41 |
+
*
|
42 |
+
* @version 3.4.5
|
43 |
+
* @since 3.4.5
|
44 |
+
*/
|
45 |
+
function maybe_update_all_rates() {
|
46 |
+
if ( isset( $_GET['wcj_currency_exchange_rates_update_now'] ) ) {
|
47 |
+
do_action( 'auto_update_exchange_rates_hook' );
|
48 |
+
wp_safe_redirect( remove_query_arg( 'wcj_currency_exchange_rates_update_now' ) );
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
/**
|
53 |
* wcj_ajax_get_exchange_rates.
|
54 |
*
|
191 |
return $settings;
|
192 |
}
|
193 |
|
194 |
+
/**
|
195 |
+
* add_currency_pair_offset_percent_setting.
|
196 |
+
*
|
197 |
+
* @version 3.4.5
|
198 |
+
* @since 3.4.5
|
199 |
+
*/
|
200 |
+
function add_currency_pair_offset_percent_setting( $currency_from, $currency_to, $default_offset, $settings ) {
|
201 |
+
if ( $currency_from != $currency_to ) {
|
202 |
+
$field_id = 'wcj_currency_exchange_rates_offset_percent_' . sanitize_title( $currency_from . $currency_to );
|
203 |
+
foreach ( $settings as $setting ) {
|
204 |
+
if ( $setting['id'] === $field_id ) {
|
205 |
+
return $settings;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
$settings[] = array(
|
209 |
+
'desc' => __( 'Exchange Rates Offset (Percent)', 'woocommerce-jetpack' ),
|
210 |
+
'id' => $field_id,
|
211 |
+
'default' => 'default_offset',
|
212 |
+
'type' => 'select',
|
213 |
+
'options' => array(
|
214 |
+
'default_offset' => sprintf( __( 'Use default: %s%%', 'woocommerce-jetpack' ), $default_offset ),
|
215 |
+
'custom_offset' => __( 'Custom offset', 'woocommerce-jetpack' ),
|
216 |
+
),
|
217 |
+
);
|
218 |
+
$settings[] = array(
|
219 |
+
'desc' => __( 'Custom offset (Percent)', 'woocommerce-jetpack' ),
|
220 |
+
'desc_tip' => __( 'Used when "Custom offset" option is selected above.', 'woocommerce-jetpack' ),
|
221 |
+
'id' => $field_id . '_' . 'custom_offset',
|
222 |
+
'default' => 0,
|
223 |
+
'type' => 'number',
|
224 |
+
'custom_attributes' => array( 'step' => '0.001' ),
|
225 |
+
);
|
226 |
+
}
|
227 |
+
return $settings;
|
228 |
+
}
|
229 |
+
|
230 |
/**
|
231 |
* get_all_currencies_exchange_rates_settings.
|
232 |
*
|
233 |
+
* @version 3.4.5
|
234 |
* @since 2.9.0
|
235 |
*/
|
236 |
+
function get_all_currencies_exchange_rates_settings( $add_extra_settings = false ) {
|
237 |
+
if ( $add_extra_settings ) {
|
238 |
+
// Server
|
239 |
$exchange_rate_servers = wcj_get_currency_exchange_rate_servers();
|
240 |
$exchange_rate_server = get_option( 'wcj_currency_exchange_rates_server', 'ecb' );
|
241 |
$default_server = ( isset( $exchange_rate_servers[ $exchange_rate_server ] ) ? $exchange_rate_servers[ $exchange_rate_server ] : $exchange_rate_server );
|
242 |
+
// Offset
|
243 |
+
$default_offset = get_option( 'wcj_currency_exchange_rates_offset_percent', 0 );
|
244 |
}
|
245 |
$settings = array();
|
246 |
$currency_from = get_option( 'woocommerce_currency' );
|
247 |
$currencies = $this->get_all_currencies_exchange_rates_currencies();
|
248 |
foreach ( $currencies as $currency ) {
|
249 |
$settings = $this->add_currency_pair_setting( $currency_from, $currency, $settings );
|
250 |
+
if ( $add_extra_settings ) {
|
251 |
$settings = $this->add_currency_pair_server_setting( $currency_from, $currency, $default_server, $settings );
|
252 |
+
$settings = $this->add_currency_pair_offset_percent_setting( $currency_from, $currency, $default_offset, $settings );
|
253 |
}
|
254 |
}
|
255 |
return $settings;
|
includes/class-wcj-currency-per-product.php
CHANGED
@@ -35,29 +35,26 @@ class WCJ_Currency_Per_Product extends WCJ_Module {
|
|
35 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
36 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
37 |
|
38 |
-
//
|
|
|
|
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
add_filter( 'woocommerce_get_cart_item_from_session', array( $this, 'get_cart_item_from_session' ), PHP_INT_MAX, 3 );
|
48 |
-
add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_on_add_to_cart' ), PHP_INT_MAX, 2 );
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
add_filter( 'woocommerce_product_variation_get_price', array( $this, 'change_price' ), PHP_INT_MAX, 2 );
|
53 |
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
// Shipping
|
58 |
-
add_filter( 'woocommerce_package_rates', array( $this, 'change_shipping_price' ), PHP_INT_MAX, 2 );
|
59 |
-
|
60 |
-
//}
|
61 |
}
|
62 |
}
|
63 |
|
35 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
36 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
37 |
|
38 |
+
// Currency code and symbol
|
39 |
+
add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol' ), PHP_INT_MAX, 2 );
|
40 |
+
add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), PHP_INT_MAX );
|
41 |
|
42 |
+
// Add to cart
|
43 |
+
add_filter( 'woocommerce_add_cart_item_data', array( $this, 'add_cart_item_data' ), PHP_INT_MAX, 3 );
|
44 |
+
add_filter( 'woocommerce_add_cart_item', array( $this, 'add_cart_item' ), PHP_INT_MAX, 2 );
|
45 |
+
add_filter( 'woocommerce_get_cart_item_from_session', array( $this, 'get_cart_item_from_session' ), PHP_INT_MAX, 3 );
|
46 |
+
add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_on_add_to_cart' ), PHP_INT_MAX, 2 );
|
47 |
|
48 |
+
// Price
|
49 |
+
add_filter( WCJ_PRODUCT_GET_PRICE_FILTER, array( $this, 'change_price' ), PHP_INT_MAX, 2 );
|
50 |
+
add_filter( 'woocommerce_product_variation_get_price', array( $this, 'change_price' ), PHP_INT_MAX, 2 );
|
|
|
|
|
51 |
|
52 |
+
// Grouped
|
53 |
+
add_filter( 'woocommerce_grouped_price_html', array( $this, 'grouped_price_html' ), PHP_INT_MAX, 2 );
|
|
|
54 |
|
55 |
+
// Shipping
|
56 |
+
add_filter( 'woocommerce_package_rates', array( $this, 'change_shipping_price' ), PHP_INT_MAX, 2 );
|
57 |
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
}
|
60 |
|
includes/class-wcj-general.php
CHANGED
@@ -130,7 +130,7 @@ class WCJ_General extends WCJ_Module {
|
|
130 |
* @todo this is only temporary solution!
|
131 |
*/
|
132 |
function fix_mini_cart() {
|
133 |
-
if (
|
134 |
if ( null !== ( $wc = WC() ) ) {
|
135 |
if ( isset( $wc->cart ) ) {
|
136 |
$wc->cart->calculate_totals();
|
130 |
* @todo this is only temporary solution!
|
131 |
*/
|
132 |
function fix_mini_cart() {
|
133 |
+
if ( wcj_is_frontend() ) {
|
134 |
if ( null !== ( $wc = WC() ) ) {
|
135 |
if ( isset( $wc->cart ) ) {
|
136 |
$wc->cart->calculate_totals();
|
includes/class-wcj-global-discount.php
CHANGED
@@ -30,7 +30,7 @@ class WCJ_Global_Discount extends WCJ_Module {
|
|
30 |
parent::__construct();
|
31 |
|
32 |
if ( $this->is_enabled() ) {
|
33 |
-
if (
|
34 |
wcj_add_change_price_hooks( $this, PHP_INT_MAX, false );
|
35 |
}
|
36 |
}
|
30 |
parent::__construct();
|
31 |
|
32 |
if ( $this->is_enabled() ) {
|
33 |
+
if ( wcj_is_frontend() ) {
|
34 |
wcj_add_change_price_hooks( $this, PHP_INT_MAX, false );
|
35 |
}
|
36 |
}
|
includes/class-wcj-multicurrency-product-base-price.php
CHANGED
@@ -34,7 +34,7 @@ class WCJ_Multicurrency_Base_Price extends WCJ_Module {
|
|
34 |
|
35 |
add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol_on_product_edit' ), PHP_INT_MAX, 2 );
|
36 |
|
37 |
-
if (
|
38 |
wcj_add_change_price_hooks( $this, PHP_INT_MAX - 10, false );
|
39 |
}
|
40 |
|
34 |
|
35 |
add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol_on_product_edit' ), PHP_INT_MAX, 2 );
|
36 |
|
37 |
+
if ( wcj_is_frontend() ) {
|
38 |
wcj_add_change_price_hooks( $this, PHP_INT_MAX - 10, false );
|
39 |
}
|
40 |
|
includes/class-wcj-multicurrency.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Module - Multicurrency (Currency Switcher)
|
4 |
*
|
5 |
-
* @version 3.4.
|
6 |
* @since 2.4.3
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
@@ -16,7 +16,8 @@ class WCJ_Multicurrency extends WCJ_Module {
|
|
16 |
/**
|
17 |
* Constructor.
|
18 |
*
|
19 |
-
* @version 3.
|
|
|
20 |
*/
|
21 |
function __construct() {
|
22 |
|
@@ -34,7 +35,14 @@ class WCJ_Multicurrency extends WCJ_Module {
|
|
34 |
|
35 |
$this->price_hooks_priority = wcj_get_module_price_hooks_priority( 'multicurrency' );
|
36 |
|
37 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
$this->add_hooks();
|
39 |
|
40 |
if ( 'yes' === get_option( 'wcj_multicurrency_per_product_enabled' , 'yes' ) ) {
|
@@ -51,26 +59,19 @@ class WCJ_Multicurrency extends WCJ_Module {
|
|
51 |
/**
|
52 |
* add_hooks.
|
53 |
*
|
54 |
-
* @version 3.4.
|
55 |
* @todo (maybe) replace all `PHP_INT_MAX - 1` with `$this->price_hooks_priority` (especially for `woocommerce_currency_symbol` and `woocommerce_currency`)
|
56 |
*/
|
57 |
function add_hooks() {
|
58 |
-
|
59 |
-
|
60 |
-
if ( isset( $_REQUEST['wcj-currency'] ) ) {
|
61 |
-
wcj_session_set( 'wcj-currency', $_REQUEST['wcj-currency'] );
|
62 |
-
}
|
63 |
-
if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
64 |
// Prices - Compatibility - "WooCommerce TM Extra Product Options" plugin
|
65 |
-
add_filter( 'woocommerce_tm_epo_price_on_cart',
|
66 |
-
add_filter( 'wc_epo_price',
|
67 |
-
// add_filter( 'woocommerce_tm_epo_price_per_currency_diff', array( $this, 'change_price_by_currency_tm_extra_product_options_plugin_cart' ), PHP_INT_MAX - 1, 1 );
|
68 |
-
// add_filter( 'woocommerce_tm_epo_price_add_on_cart', array( $this, 'change_price_by_currency_tm_extra_product_options_plugin_cart' ), PHP_INT_MAX - 1, 1 );
|
69 |
-
// add_filter( 'wc_aelia_cs_enabled_currencies', array( $this, 'add_currency' ), PHP_INT_MAX - 1, 1 );
|
70 |
|
71 |
// Currency hooks
|
72 |
-
add_filter( 'woocommerce_currency_symbol',
|
73 |
-
add_filter( 'woocommerce_currency',
|
74 |
|
75 |
// Add "Change Price" hooks
|
76 |
wcj_add_change_price_hooks( $this, $this->price_hooks_priority );
|
@@ -88,6 +89,20 @@ class WCJ_Multicurrency extends WCJ_Module {
|
|
88 |
} else {
|
89 |
$this->additional_price_filters = array();
|
90 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
}
|
93 |
|
2 |
/**
|
3 |
* Booster for WooCommerce - Module - Multicurrency (Currency Switcher)
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.4.3
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
16 |
/**
|
17 |
* Constructor.
|
18 |
*
|
19 |
+
* @version 3.4.5
|
20 |
+
* @todo check if we can just always execute `init()` on `init` hook
|
21 |
*/
|
22 |
function __construct() {
|
23 |
|
35 |
|
36 |
$this->price_hooks_priority = wcj_get_module_price_hooks_priority( 'multicurrency' );
|
37 |
|
38 |
+
// Session
|
39 |
+
if ( 'wc' === WCJ_SESSION_TYPE ) {
|
40 |
+
// `init()` executed on `init` hook because we need to use `WC()->session`
|
41 |
+
add_action( 'init', array( $this, 'init' ) );
|
42 |
+
} else {
|
43 |
+
$this->init();
|
44 |
+
}
|
45 |
+
|
46 |
$this->add_hooks();
|
47 |
|
48 |
if ( 'yes' === get_option( 'wcj_multicurrency_per_product_enabled' , 'yes' ) ) {
|
59 |
/**
|
60 |
* add_hooks.
|
61 |
*
|
62 |
+
* @version 3.4.5
|
63 |
* @todo (maybe) replace all `PHP_INT_MAX - 1` with `$this->price_hooks_priority` (especially for `woocommerce_currency_symbol` and `woocommerce_currency`)
|
64 |
*/
|
65 |
function add_hooks() {
|
66 |
+
if ( wcj_is_frontend() ) {
|
67 |
+
|
|
|
|
|
|
|
|
|
68 |
// Prices - Compatibility - "WooCommerce TM Extra Product Options" plugin
|
69 |
+
add_filter( 'woocommerce_tm_epo_price_on_cart', array( $this, 'change_price_by_currency_tm_extra_product_options_plugin_cart' ), PHP_INT_MAX - 1, 1 );
|
70 |
+
add_filter( 'wc_epo_price', array( $this, 'change_price_by_currency_tm_extra_product_options_plugin' ), PHP_INT_MAX - 1, 3 );
|
|
|
|
|
|
|
71 |
|
72 |
// Currency hooks
|
73 |
+
add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol' ), PHP_INT_MAX - 1, 2 );
|
74 |
+
add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), PHP_INT_MAX - 1, 1 );
|
75 |
|
76 |
// Add "Change Price" hooks
|
77 |
wcj_add_change_price_hooks( $this, $this->price_hooks_priority );
|
89 |
} else {
|
90 |
$this->additional_price_filters = array();
|
91 |
}
|
92 |
+
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* init.
|
98 |
+
*
|
99 |
+
* @version 3.4.5
|
100 |
+
* @since 3.4.5
|
101 |
+
*/
|
102 |
+
function init() {
|
103 |
+
wcj_session_maybe_start();
|
104 |
+
if ( isset( $_REQUEST['wcj-currency'] ) ) {
|
105 |
+
wcj_session_set( 'wcj-currency', $_REQUEST['wcj-currency'] );
|
106 |
}
|
107 |
}
|
108 |
|
includes/class-wcj-price-by-country.php
CHANGED
@@ -31,7 +31,7 @@ class WCJ_Price_By_Country extends WCJ_Module {
|
|
31 |
|
32 |
if ( $this->is_enabled() ) {
|
33 |
|
34 |
-
if (
|
35 |
$do_load_core = true;
|
36 |
/* if ( is_admin() ) {
|
37 |
global $pagenow;
|
31 |
|
32 |
if ( $this->is_enabled() ) {
|
33 |
|
34 |
+
if ( wcj_is_frontend() ) {
|
35 |
$do_load_core = true;
|
36 |
/* if ( is_admin() ) {
|
37 |
global $pagenow;
|
includes/class-wcj-price-by-user-role.php
CHANGED
@@ -34,7 +34,7 @@ class WCJ_Price_By_User_Role extends WCJ_Module {
|
|
34 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
35 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
36 |
}
|
37 |
-
if (
|
38 |
if ( 'no' === get_option( 'wcj_price_by_user_role_for_bots_disabled', 'no' ) || ! wcj_is_bot() ) {
|
39 |
wcj_add_change_price_hooks( $this, $this->price_hooks_priority );
|
40 |
if ( ( $this->disable_for_regular_price = ( 'yes' === get_option( 'wcj_price_by_user_role_disable_for_regular_price', 'no' ) ) ) ) {
|
34 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
35 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
36 |
}
|
37 |
+
if ( wcj_is_frontend() ) {
|
38 |
if ( 'no' === get_option( 'wcj_price_by_user_role_for_bots_disabled', 'no' ) || ! wcj_is_bot() ) {
|
39 |
wcj_add_change_price_hooks( $this, $this->price_hooks_priority );
|
40 |
if ( ( $this->disable_for_regular_price = ( 'yes' === get_option( 'wcj_price_by_user_role_disable_for_regular_price', 'no' ) ) ) ) {
|
includes/class-wcj-product-addons.php
CHANGED
@@ -38,7 +38,7 @@ class WCJ_Product_Addons extends WCJ_Module {
|
|
38 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
39 |
$this->co = 'wcj_product_addons_per_product_settings_enabled';
|
40 |
}
|
41 |
-
if (
|
42 |
if ( 'yes' === get_option( 'wcj_product_addons_ajax_enabled', 'no' ) ) {
|
43 |
// Scripts
|
44 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
38 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
39 |
$this->co = 'wcj_product_addons_per_product_settings_enabled';
|
40 |
}
|
41 |
+
if ( wcj_is_frontend() ) {
|
42 |
if ( 'yes' === get_option( 'wcj_product_addons_ajax_enabled', 'no' ) ) {
|
43 |
// Scripts
|
44 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
includes/class-wcj-product-bookings.php
CHANGED
@@ -33,7 +33,7 @@ class WCJ_Product_Bookings extends WCJ_Module {
|
|
33 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
34 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
35 |
|
36 |
-
if (
|
37 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
38 |
add_action( 'wp_ajax_price_change', array( $this, 'price_change_ajax' ) );
|
39 |
add_action( 'wp_ajax_nopriv_price_change', array( $this, 'price_change_ajax' ) );
|
33 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
34 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
35 |
|
36 |
+
if ( wcj_is_frontend() ) {
|
37 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
38 |
add_action( 'wp_ajax_price_change', array( $this, 'price_change_ajax' ) );
|
39 |
add_action( 'wp_ajax_nopriv_price_change', array( $this, 'price_change_ajax' ) );
|
includes/class-wcj-product-by-country.php
CHANGED
@@ -33,7 +33,7 @@ class WCJ_Product_By_Country extends WCJ_Module {
|
|
33 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
34 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
35 |
// Core
|
36 |
-
if (
|
37 |
if ( 'yes' === get_option( 'wcj_product_by_country_visibility', 'yes' ) ) {
|
38 |
add_filter( 'woocommerce_product_is_visible', array( $this, 'product_by_country' ), PHP_INT_MAX, 2 );
|
39 |
}
|
33 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
34 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
35 |
// Core
|
36 |
+
if ( wcj_is_frontend() ) {
|
37 |
if ( 'yes' === get_option( 'wcj_product_by_country_visibility', 'yes' ) ) {
|
38 |
add_filter( 'woocommerce_product_is_visible', array( $this, 'product_by_country' ), PHP_INT_MAX, 2 );
|
39 |
}
|
includes/class-wcj-product-by-user-role.php
CHANGED
@@ -32,7 +32,7 @@ class WCJ_Product_By_User_Role extends WCJ_Module {
|
|
32 |
if ( $this->is_enabled() ) {
|
33 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
34 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
35 |
-
if (
|
36 |
if ( 'yes' === get_option( 'wcj_product_by_user_role_visibility', 'yes' ) ) {
|
37 |
add_filter( 'woocommerce_product_is_visible', array( $this, 'product_by_user_role_visibility' ), PHP_INT_MAX, 2 );
|
38 |
}
|
32 |
if ( $this->is_enabled() ) {
|
33 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
34 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
35 |
+
if ( wcj_is_frontend() ) {
|
36 |
if ( 'yes' === get_option( 'wcj_product_by_user_role_visibility', 'yes' ) ) {
|
37 |
add_filter( 'woocommerce_product_is_visible', array( $this, 'product_by_user_role_visibility' ), PHP_INT_MAX, 2 );
|
38 |
}
|
includes/class-wcj-product-custom-visibility.php
CHANGED
@@ -40,7 +40,7 @@ class WCJ_Product_Custom_Visibility extends WCJ_Module {
|
|
40 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
41 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
42 |
// Core
|
43 |
-
if (
|
44 |
if ( 'yes' === get_option( 'wcj_product_custom_visibility_visibility', 'yes' ) ) {
|
45 |
add_filter( 'woocommerce_product_is_visible', array( $this, 'product_custom_visibility_visibility' ), PHP_INT_MAX, 2 );
|
46 |
}
|
40 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
41 |
add_action( 'save_post_product', array( $this, 'save_meta_box' ), PHP_INT_MAX, 2 );
|
42 |
// Core
|
43 |
+
if ( wcj_is_frontend() ) {
|
44 |
if ( 'yes' === get_option( 'wcj_product_custom_visibility_visibility', 'yes' ) ) {
|
45 |
add_filter( 'woocommerce_product_is_visible', array( $this, 'product_custom_visibility_visibility' ), PHP_INT_MAX, 2 );
|
46 |
}
|
includes/class-wcj-product-tabs.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Module - Product Tabs
|
4 |
*
|
5 |
-
* @version 3.4.
|
6 |
* @author Algoritmika Ltd.
|
7 |
*/
|
8 |
|
@@ -464,22 +464,39 @@ class WCJ_Product_Tabs extends WCJ_Module {
|
|
464 |
}
|
465 |
}
|
466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
/**
|
468 |
* create_new_custom_product_tab_local.
|
469 |
*
|
470 |
-
* @version 3.4.
|
471 |
*/
|
472 |
function create_new_custom_product_tab_local( $key, $tab ) {
|
473 |
-
echo
|
474 |
}
|
475 |
|
476 |
/**
|
477 |
* create_new_custom_product_tab_global.
|
478 |
*
|
479 |
-
* @version 3.4.
|
480 |
*/
|
481 |
function create_new_custom_product_tab_global( $key, $tab ) {
|
482 |
-
echo
|
483 |
}
|
484 |
|
485 |
/**
|
2 |
/**
|
3 |
* Booster for WooCommerce - Module - Product Tabs
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @author Algoritmika Ltd.
|
7 |
*/
|
8 |
|
464 |
}
|
465 |
}
|
466 |
|
467 |
+
/**
|
468 |
+
* get_tab_output.
|
469 |
+
*
|
470 |
+
* @version 3.4.5
|
471 |
+
* @since 3.4.5
|
472 |
+
*/
|
473 |
+
function get_tab_output( $content ) {
|
474 |
+
switch ( get_option( 'wcj_custom_product_tabs_general_content_processing', 'the_content' ) ) {
|
475 |
+
case 'disabled':
|
476 |
+
return $content;
|
477 |
+
case 'do_shortcode':
|
478 |
+
return do_shortcode( $content );
|
479 |
+
default: // case 'the_content':
|
480 |
+
return apply_filters( 'the_content', $content );
|
481 |
+
}
|
482 |
+
}
|
483 |
+
|
484 |
/**
|
485 |
* create_new_custom_product_tab_local.
|
486 |
*
|
487 |
+
* @version 3.4.5
|
488 |
*/
|
489 |
function create_new_custom_product_tab_local( $key, $tab ) {
|
490 |
+
echo $this->get_tab_output( get_post_meta( get_the_ID(), '_' . 'wcj_custom_product_tabs_content_' . $this->tab_option_keys['local'][ $key ], true ) );
|
491 |
}
|
492 |
|
493 |
/**
|
494 |
* create_new_custom_product_tab_global.
|
495 |
*
|
496 |
+
* @version 3.4.5
|
497 |
*/
|
498 |
function create_new_custom_product_tab_global( $key, $tab ) {
|
499 |
+
echo $this->get_tab_output( get_option( 'wcj_custom_product_tabs_content_' . $this->tab_option_keys['global'][ $key ] ) );
|
500 |
}
|
501 |
|
502 |
/**
|
includes/core/wcj-constants.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce Constants
|
4 |
*
|
5 |
-
* @version 3.4.
|
6 |
* @since 2.7.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
@@ -39,6 +39,16 @@ if ( ! defined( 'WCJ_IS_WC_VERSION_BELOW_3_2_0' ) ) {
|
|
39 |
define( 'WCJ_IS_WC_VERSION_BELOW_3_2_0', version_compare( WCJ_WC_VERSION, '3.2.0', '<' ) );
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
if ( ! defined( 'WCJ_PRODUCT_GET_PRICE_FILTER' ) ) {
|
43 |
/**
|
44 |
* Price filters - price.
|
@@ -73,12 +83,10 @@ if ( ! defined( 'WCJ_SESSION_TYPE' ) ) {
|
|
73 |
/**
|
74 |
* Session type.
|
75 |
*
|
76 |
-
* @version 3.4.
|
77 |
* @since 3.1.0
|
78 |
-
* @todo ! this is only a temporary "fix"
|
79 |
*/
|
80 |
-
define( 'WCJ_SESSION_TYPE', '
|
81 |
-
// define( 'WCJ_SESSION_TYPE', ( 'yes' === get_option( 'wcj_general_enabled', 'no' ) ? get_option( 'wcj_general_advanced_session_type', 'wc' ) : 'wc' ) );
|
82 |
}
|
83 |
|
84 |
if ( ! defined( 'WCJ_VERSION_OPTION' ) ) {
|
2 |
/**
|
3 |
* Booster for WooCommerce Constants
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.7.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
39 |
define( 'WCJ_IS_WC_VERSION_BELOW_3_2_0', version_compare( WCJ_WC_VERSION, '3.2.0', '<' ) );
|
40 |
}
|
41 |
|
42 |
+
if ( ! defined( 'WCJ_IS_WC_VERSION_BELOW_3_3_0' ) ) {
|
43 |
+
/**
|
44 |
+
* WooCommerce version - is below version 3.3.0.
|
45 |
+
*
|
46 |
+
* @version 3.4.5
|
47 |
+
* @since 3.4.5
|
48 |
+
*/
|
49 |
+
define( 'WCJ_IS_WC_VERSION_BELOW_3_3_0', version_compare( WCJ_WC_VERSION, '3.3.0', '<' ) );
|
50 |
+
}
|
51 |
+
|
52 |
if ( ! defined( 'WCJ_PRODUCT_GET_PRICE_FILTER' ) ) {
|
53 |
/**
|
54 |
* Price filters - price.
|
83 |
/**
|
84 |
* Session type.
|
85 |
*
|
86 |
+
* @version 3.4.5
|
87 |
* @since 3.1.0
|
|
|
88 |
*/
|
89 |
+
define( 'WCJ_SESSION_TYPE', ( 'yes' === get_option( 'wcj_general_enabled', 'no' ) ? get_option( 'wcj_general_advanced_session_type', 'wc' ) : 'wc' ) );
|
|
|
90 |
}
|
91 |
|
92 |
if ( ! defined( 'WCJ_VERSION_OPTION' ) ) {
|
includes/exchange-rates/class-wcj-exchange-rates-crons.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Booster for WooCommerce Exchange Rates Crons
|
4 |
*
|
5 |
-
* @version
|
6 |
* @author Algoritmika Ltd.
|
7 |
*/
|
8 |
|
@@ -59,7 +59,6 @@ class WCJ_Exchange_Rates_Crons {
|
|
59 |
* @since 2.3.0
|
60 |
*/
|
61 |
function get_currency_pair( $currency_pairs, $currency_to, $option_name ) {
|
62 |
-
|
63 |
foreach ( $currency_pairs as $k => $currency_pair ) {
|
64 |
if ( $currency_pair['currency_to'] == $currency_to ) {
|
65 |
$currency_pairs[ $k ]['option_name'][] = $option_name;
|
@@ -77,12 +76,12 @@ class WCJ_Exchange_Rates_Crons {
|
|
77 |
/**
|
78 |
* On the scheduled action hook, run a function.
|
79 |
*
|
80 |
-
* @version
|
81 |
* @todo get currency pairs from "Currency Exchange Rates" module (see `get_all_currencies_exchange_rates_currencies()`)
|
82 |
*/
|
83 |
function update_the_exchange_rates( $interval ) {
|
84 |
|
85 |
-
$currency_pairs
|
86 |
|
87 |
if ( wcj_is_module_enabled( 'price_by_country' ) ) {
|
88 |
// Currency Pairs - Preparation - Price by Country
|
@@ -153,10 +152,6 @@ class WCJ_Exchange_Rates_Crons {
|
|
153 |
}
|
154 |
|
155 |
// Currency Pairs - Final
|
156 |
-
$rate_offset_percent = get_option( 'wcj_currency_exchange_rates_offset_percent', 0 );
|
157 |
-
if ( 0 != $rate_offset_percent ) {
|
158 |
-
$rate_offset_percent = 1 + ( $rate_offset_percent / 100 );
|
159 |
-
}
|
160 |
$rate_offset_fixed = get_option( 'wcj_currency_exchange_rates_offset_fixed', 0 );
|
161 |
if ( $rate_rounding_enabled = ( 'yes' === get_option( 'wcj_currency_exchange_rates_rounding_enabled', 'no' ) ) ) {
|
162 |
$rate_rounding_precision = get_option( 'wcj_currency_exchange_rates_rounding_precision', 0 );
|
@@ -164,6 +159,10 @@ class WCJ_Exchange_Rates_Crons {
|
|
164 |
foreach ( $currency_pairs as $currency_pair ) {
|
165 |
$currency_from = $currency_pair['currency_from'];
|
166 |
$currency_to = $currency_pair['currency_to'];
|
|
|
|
|
|
|
|
|
167 |
$the_rate = wcj_get_exchange_rate( $currency_from, $currency_to );
|
168 |
if ( 0 != $the_rate ) {
|
169 |
if ( 0 != $rate_offset_percent ) {
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Booster for WooCommerce - Exchange Rates - Crons
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @author Algoritmika Ltd.
|
7 |
*/
|
8 |
|
59 |
* @since 2.3.0
|
60 |
*/
|
61 |
function get_currency_pair( $currency_pairs, $currency_to, $option_name ) {
|
|
|
62 |
foreach ( $currency_pairs as $k => $currency_pair ) {
|
63 |
if ( $currency_pair['currency_to'] == $currency_to ) {
|
64 |
$currency_pairs[ $k ]['option_name'][] = $option_name;
|
76 |
/**
|
77 |
* On the scheduled action hook, run a function.
|
78 |
*
|
79 |
+
* @version 3.4.5
|
80 |
* @todo get currency pairs from "Currency Exchange Rates" module (see `get_all_currencies_exchange_rates_currencies()`)
|
81 |
*/
|
82 |
function update_the_exchange_rates( $interval ) {
|
83 |
|
84 |
+
$currency_pairs = array();
|
85 |
|
86 |
if ( wcj_is_module_enabled( 'price_by_country' ) ) {
|
87 |
// Currency Pairs - Preparation - Price by Country
|
152 |
}
|
153 |
|
154 |
// Currency Pairs - Final
|
|
|
|
|
|
|
|
|
155 |
$rate_offset_fixed = get_option( 'wcj_currency_exchange_rates_offset_fixed', 0 );
|
156 |
if ( $rate_rounding_enabled = ( 'yes' === get_option( 'wcj_currency_exchange_rates_rounding_enabled', 'no' ) ) ) {
|
157 |
$rate_rounding_precision = get_option( 'wcj_currency_exchange_rates_rounding_precision', 0 );
|
159 |
foreach ( $currency_pairs as $currency_pair ) {
|
160 |
$currency_from = $currency_pair['currency_from'];
|
161 |
$currency_to = $currency_pair['currency_to'];
|
162 |
+
$rate_offset_percent = wcj_get_currency_exchange_rate_offset_percent( $currency_from, $currency_to );
|
163 |
+
if ( 0 != $rate_offset_percent ) {
|
164 |
+
$rate_offset_percent = 1 + ( $rate_offset_percent / 100 );
|
165 |
+
}
|
166 |
$the_rate = wcj_get_exchange_rate( $currency_from, $currency_to );
|
167 |
if ( 0 != $the_rate ) {
|
168 |
if ( 0 != $rate_offset_percent ) {
|
includes/functions/wcj-functions-exchange-rates.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Functions - Exchange Rates
|
4 |
*
|
5 |
-
* @version 3.4.
|
6 |
* @since 2.7.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
@@ -91,6 +91,22 @@ if ( ! function_exists( 'wcj_get_currency_exchange_rate_server' ) ) {
|
|
91 |
}
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
if ( ! function_exists( 'wcj_get_currency_exchange_rate_server_name' ) ) {
|
95 |
/*
|
96 |
* wcj_get_currency_exchange_rate_server_name.
|
2 |
/**
|
3 |
* Booster for WooCommerce - Functions - Exchange Rates
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.7.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
if ( ! function_exists( 'wcj_get_currency_exchange_rate_offset_percent' ) ) {
|
95 |
+
/*
|
96 |
+
* wcj_get_currency_exchange_rate_offset_percent.
|
97 |
+
*
|
98 |
+
* @version 3.4.5
|
99 |
+
* @since 3.4.5
|
100 |
+
*/
|
101 |
+
function wcj_get_currency_exchange_rate_offset_percent( $currency_from, $currency_to ) {
|
102 |
+
$field_id = 'wcj_currency_exchange_rates_offset_percent_' . sanitize_title( $currency_from . $currency_to );
|
103 |
+
if ( 'default_offset' === get_option( $field_id, 'default_offset' ) ) {
|
104 |
+
return get_option( 'wcj_currency_exchange_rates_offset_percent', 0 );
|
105 |
+
}
|
106 |
+
return get_option( $field_id . '_' . 'custom_offset', 0 );
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
if ( ! function_exists( 'wcj_get_currency_exchange_rate_server_name' ) ) {
|
111 |
/*
|
112 |
* wcj_get_currency_exchange_rate_server_name.
|
includes/price-by-country/class-wcj-price-by-country-core.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Price by Country - Core
|
4 |
*
|
5 |
-
* @version 3.4.
|
6 |
* @author Algoritmika Ltd.
|
7 |
*/
|
8 |
|
@@ -15,12 +15,20 @@ class WCJ_Price_by_Country_Core {
|
|
15 |
/**
|
16 |
* Constructor.
|
17 |
*
|
18 |
-
* @version
|
|
|
19 |
*/
|
20 |
function __construct() {
|
21 |
$this->customer_country_group_id = null;
|
22 |
if ( 'no' === get_option( 'wcj_price_by_country_for_bots_disabled', 'no' ) || ! wcj_is_bot() ) {
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
$this->add_hooks();
|
25 |
// `maybe_init_customer_country_by_ip()` executed on `init` hook - in case we need to call `get_customer_country_by_ip()` `WC_Geolocation` class is ready
|
26 |
add_action( 'init', array( $this, 'maybe_init_customer_country_by_ip' ) );
|
@@ -28,20 +36,15 @@ class WCJ_Price_by_Country_Core {
|
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
-
*
|
32 |
*
|
33 |
-
* @version 3.4.
|
34 |
* @since 2.9.0
|
35 |
*/
|
36 |
-
function
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
) {
|
41 |
-
wcj_session_maybe_start();
|
42 |
-
if ( isset( $_REQUEST[ 'wcj-country' ] ) ) {
|
43 |
-
wcj_session_set( 'wcj-country', $_REQUEST[ 'wcj-country' ] );
|
44 |
-
}
|
45 |
}
|
46 |
}
|
47 |
|
2 |
/**
|
3 |
* Booster for WooCommerce - Price by Country - Core
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @author Algoritmika Ltd.
|
7 |
*/
|
8 |
|
15 |
/**
|
16 |
* Constructor.
|
17 |
*
|
18 |
+
* @version 3.4.5
|
19 |
+
* @todo check if we can just always execute `init()` on `init` hook
|
20 |
*/
|
21 |
function __construct() {
|
22 |
$this->customer_country_group_id = null;
|
23 |
if ( 'no' === get_option( 'wcj_price_by_country_for_bots_disabled', 'no' ) || ! wcj_is_bot() ) {
|
24 |
+
if ( in_array( get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ), array( 'by_user_selection', 'by_ip_then_by_user_selection' ) ) ) {
|
25 |
+
if ( 'wc' === WCJ_SESSION_TYPE ) {
|
26 |
+
// `init()` executed on `init` hook because we need to use `WC()->session`
|
27 |
+
add_action( 'init', array( $this, 'init' ) );
|
28 |
+
} else {
|
29 |
+
$this->init();
|
30 |
+
}
|
31 |
+
}
|
32 |
$this->add_hooks();
|
33 |
// `maybe_init_customer_country_by_ip()` executed on `init` hook - in case we need to call `get_customer_country_by_ip()` `WC_Geolocation` class is ready
|
34 |
add_action( 'init', array( $this, 'maybe_init_customer_country_by_ip' ) );
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
+
* init.
|
40 |
*
|
41 |
+
* @version 3.4.5
|
42 |
* @since 2.9.0
|
43 |
*/
|
44 |
+
function init() {
|
45 |
+
wcj_session_maybe_start();
|
46 |
+
if ( isset( $_REQUEST[ 'wcj-country' ] ) ) {
|
47 |
+
wcj_session_set( 'wcj-country', $_REQUEST[ 'wcj-country' ] );
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
}
|
50 |
|
includes/settings/wcj-settings-currency-exchange-rates.php
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Settings - Currency Exchange Rates
|
4 |
*
|
5 |
-
* @version 3.
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
-
* @todo add "rounding" and "offset" options for each pair separately
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -25,7 +25,6 @@ $settings = array(
|
|
25 |
array(
|
26 |
'title' => __( 'General Options', 'woocommerce-jetpack' ),
|
27 |
'type' => 'title',
|
28 |
-
'desc' => __( 'All currencies from all <strong>enabled</strong> modules (with "Exchange Rates Updates" set to "Automatically via Currency Exchange Rates module") will be automatically added to the list.', 'woocommerce-jetpack' ) . $desc,
|
29 |
'id' => 'wcj_currency_exchange_rates_options',
|
30 |
),
|
31 |
array(
|
@@ -34,13 +33,14 @@ $settings = array(
|
|
34 |
'default' => 'daily',
|
35 |
'type' => 'select',
|
36 |
'options' => array(
|
37 |
-
// 'manual' => __( 'Enter Rates Manually', 'woocommerce-jetpack' ),
|
38 |
'minutely' => __( 'Update Every Minute', 'woocommerce-jetpack' ),
|
39 |
'hourly' => __( 'Update Hourly', 'woocommerce-jetpack' ),
|
40 |
'twicedaily' => __( 'Update Twice Daily', 'woocommerce-jetpack' ),
|
41 |
'daily' => __( 'Update Daily', 'woocommerce-jetpack' ),
|
42 |
'weekly' => __( 'Update Weekly', 'woocommerce-jetpack' ),
|
43 |
),
|
|
|
|
|
44 |
),
|
45 |
array(
|
46 |
'title' => __( 'Exchange Rates Server', 'woocommerce-jetpack' ),
|
@@ -58,6 +58,7 @@ $settings = array(
|
|
58 |
),
|
59 |
array(
|
60 |
'desc' => __( 'Rounding Precision', 'woocommerce-jetpack' ),
|
|
|
61 |
'id' => 'wcj_currency_exchange_rates_rounding_precision',
|
62 |
'default' => 0,
|
63 |
'type' => 'number',
|
@@ -155,6 +156,7 @@ if ( ! empty( $exchange_rate_settings ) ) {
|
|
155 |
array(
|
156 |
'title' => __( 'Exchange Rates', 'woocommerce-jetpack' ),
|
157 |
'type' => 'title',
|
|
|
158 |
'id' => 'wcj_currency_exchange_rates_rates',
|
159 |
),
|
160 |
) );
|
2 |
/**
|
3 |
* Booster for WooCommerce - Settings - Currency Exchange Rates
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
+
* @todo add "rounding" and "fixed offset" options for each pair separately (and option to enable/disable these per pair extra settings)
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
25 |
array(
|
26 |
'title' => __( 'General Options', 'woocommerce-jetpack' ),
|
27 |
'type' => 'title',
|
|
|
28 |
'id' => 'wcj_currency_exchange_rates_options',
|
29 |
),
|
30 |
array(
|
33 |
'default' => 'daily',
|
34 |
'type' => 'select',
|
35 |
'options' => array(
|
|
|
36 |
'minutely' => __( 'Update Every Minute', 'woocommerce-jetpack' ),
|
37 |
'hourly' => __( 'Update Hourly', 'woocommerce-jetpack' ),
|
38 |
'twicedaily' => __( 'Update Twice Daily', 'woocommerce-jetpack' ),
|
39 |
'daily' => __( 'Update Daily', 'woocommerce-jetpack' ),
|
40 |
'weekly' => __( 'Update Weekly', 'woocommerce-jetpack' ),
|
41 |
),
|
42 |
+
'desc' => ( $this->is_enabled() ?
|
43 |
+
$desc . ' ' . '<a href="' . add_query_arg( 'wcj_currency_exchange_rates_update_now', '1' ) . '">' . __( 'Update all rates now', 'woocommerce-jetpack' ) . '</a>' : '' ),
|
44 |
),
|
45 |
array(
|
46 |
'title' => __( 'Exchange Rates Server', 'woocommerce-jetpack' ),
|
58 |
),
|
59 |
array(
|
60 |
'desc' => __( 'Rounding Precision', 'woocommerce-jetpack' ),
|
61 |
+
'desc_tip' => __( 'Rounding precision sets number of decimal digits to round to.', 'woocommerce-jetpack' ),
|
62 |
'id' => 'wcj_currency_exchange_rates_rounding_precision',
|
63 |
'default' => 0,
|
64 |
'type' => 'number',
|
156 |
array(
|
157 |
'title' => __( 'Exchange Rates', 'woocommerce-jetpack' ),
|
158 |
'type' => 'title',
|
159 |
+
'desc' => __( 'All currencies from all <strong>enabled</strong> modules (with "Exchange Rates Updates" set to "Automatically via Currency Exchange Rates module") will be automatically added to the list.', 'woocommerce-jetpack' ),
|
160 |
'id' => 'wcj_currency_exchange_rates_rates',
|
161 |
),
|
162 |
) );
|
includes/settings/wcj-settings-general.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Settings - General
|
4 |
*
|
5 |
-
* @version 3.4.
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
* @todo add link to Booster's shortcodes list
|
@@ -85,7 +85,7 @@ $settings = array(
|
|
85 |
'default' => 'no',
|
86 |
'type' => 'checkbox',
|
87 |
),
|
88 |
-
|
89 |
'title' => __( 'Session Type in Booster', 'woocommerce-jetpack' ),
|
90 |
'id' => 'wcj_general_advanced_session_type',
|
91 |
'default' => 'wc',
|
@@ -94,7 +94,7 @@ $settings = array(
|
|
94 |
'standard' => __( 'Standard PHP sessions', 'woocommerce-jetpack' ),
|
95 |
'wc' => __( 'WC sessions', 'woocommerce-jetpack' ),
|
96 |
),
|
97 |
-
),
|
98 |
array(
|
99 |
'title' => __( 'Disable Loading Datepicker/Weekpicker CSS', 'woocommerce-jetpack' ),
|
100 |
'desc' => __( 'Disable', 'woocommerce-jetpack' ),
|
2 |
/**
|
3 |
* Booster for WooCommerce - Settings - General
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
* @todo add link to Booster's shortcodes list
|
85 |
'default' => 'no',
|
86 |
'type' => 'checkbox',
|
87 |
),
|
88 |
+
array(
|
89 |
'title' => __( 'Session Type in Booster', 'woocommerce-jetpack' ),
|
90 |
'id' => 'wcj_general_advanced_session_type',
|
91 |
'default' => 'wc',
|
94 |
'standard' => __( 'Standard PHP sessions', 'woocommerce-jetpack' ),
|
95 |
'wc' => __( 'WC sessions', 'woocommerce-jetpack' ),
|
96 |
),
|
97 |
+
),
|
98 |
array(
|
99 |
'title' => __( 'Disable Loading Datepicker/Weekpicker CSS', 'woocommerce-jetpack' ),
|
100 |
'desc' => __( 'Disable', 'woocommerce-jetpack' ),
|
includes/settings/wcj-settings-product-listings.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce - Settings - Admin Tools
|
4 |
*
|
5 |
-
* @version 3.
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
@@ -30,10 +30,10 @@ return array(
|
|
30 |
array(
|
31 |
'title' => __( 'Shop Page Display Options', 'woocommerce-jetpack' ),
|
32 |
'type' => 'title',
|
33 |
-
'desc' => sprintf(
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
'id' => 'wcj_product_listings_shop_page_options',
|
38 |
),
|
39 |
array(
|
@@ -74,10 +74,10 @@ return array(
|
|
74 |
array(
|
75 |
'title' => __( 'Category Display Options', 'woocommerce-jetpack' ),
|
76 |
'type' => 'title',
|
77 |
-
'desc' => sprintf(
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
'id' => 'wcj_product_listings_archive_pages_options',
|
82 |
),
|
83 |
array(
|
2 |
/**
|
3 |
* Booster for WooCommerce - Settings - Admin Tools
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
*/
|
30 |
array(
|
31 |
'title' => __( 'Shop Page Display Options', 'woocommerce-jetpack' ),
|
32 |
'type' => 'title',
|
33 |
+
'desc' => ( WCJ_IS_WC_VERSION_BELOW_3_3_0 ? sprintf(
|
34 |
+
__( 'You can control what is shown on the product archive in <a href="%s">WooCommerce > Settings > Products > Display > Shop page display</a>.', 'woocommerce-jetpack' ),
|
35 |
+
admin_url( 'admin.php?page=wc-settings&tab=products§ion=display' )
|
36 |
+
) : '' ),
|
37 |
'id' => 'wcj_product_listings_shop_page_options',
|
38 |
),
|
39 |
array(
|
74 |
array(
|
75 |
'title' => __( 'Category Display Options', 'woocommerce-jetpack' ),
|
76 |
'type' => 'title',
|
77 |
+
'desc' => ( WCJ_IS_WC_VERSION_BELOW_3_3_0 ? sprintf(
|
78 |
+
__( 'You can control what is shown on category archives in <a href="%s">WooCommerce > Settings > Products > Display > Default category display</a>.', 'woocommerce-jetpack' ),
|
79 |
+
admin_url( 'admin.php?page=wc-settings&tab=products§ion=display' )
|
80 |
+
) : '' ),
|
81 |
'id' => 'wcj_product_listings_archive_pages_options',
|
82 |
),
|
83 |
array(
|
includes/settings/wcj-settings-product-tabs.php
CHANGED
@@ -2,15 +2,35 @@
|
|
2 |
/**
|
3 |
* Booster for WooCommerce Settings - Product Tabs
|
4 |
*
|
5 |
-
* @version 3.
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
8 |
-
* @todo clean up
|
9 |
*/
|
10 |
|
11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
12 |
|
13 |
$settings = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
// Global Custom Tabs
|
15 |
array(
|
16 |
'title' => __( 'Custom Product Tabs - All Products', 'woocommerce-jetpack' ),
|
2 |
/**
|
3 |
* Booster for WooCommerce Settings - Product Tabs
|
4 |
*
|
5 |
+
* @version 3.4.5
|
6 |
* @since 2.8.0
|
7 |
* @author Algoritmika Ltd.
|
|
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
|
12 |
$settings = array(
|
13 |
+
// General settings
|
14 |
+
array(
|
15 |
+
'title' => __( 'General Options', 'woocommerce-jetpack' ),
|
16 |
+
'type' => 'title',
|
17 |
+
'id' => 'wcj_custom_product_tabs_general_options',
|
18 |
+
),
|
19 |
+
array(
|
20 |
+
'title' => __( 'Content Processing', 'woocommerce-jetpack' ),
|
21 |
+
'type' => 'select',
|
22 |
+
'id' => 'wcj_custom_product_tabs_general_content_processing',
|
23 |
+
'default' => 'the_content',
|
24 |
+
'options' => array(
|
25 |
+
'the_content' => sprintf( __( 'Apply %s filter', 'woocommerce-jetpack' ), 'the_content' ),
|
26 |
+
'do_shortcode' => __( 'Only process shortcodes', 'woocommerce-jetpack' ),
|
27 |
+
'disabled' => __( 'Do nothing', 'woocommerce-jetpack' ),
|
28 |
+
),
|
29 |
+
),
|
30 |
+
array(
|
31 |
+
'type' => 'sectionend',
|
32 |
+
'id' => 'wcj_custom_product_tabs_general_options',
|
33 |
+
),
|
34 |
// Global Custom Tabs
|
35 |
array(
|
36 |
'title' => __( 'Custom Product Tabs - All Products', 'woocommerce-jetpack' ),
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: algoritmika, anbinder
|
|
3 |
Tags: woocommerce, booster for woocommerce, woocommerce jetpack
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 3.4.
|
7 |
License: GNU General Public License v3.0
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -180,6 +180,18 @@ You can see the differences between versions in this [table](https://booster.io/
|
|
180 |
|
181 |
== Changelog ==
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
= 3.4.4 - 15/02/2018 =
|
184 |
* Fix - PDF INVOICING & PACKING SLIPS - `K_TCPDF_CALLS_IN_HTML` set to `true` (fixes the issue with using TCPDF methods in HTML, e.g. `[wcj_tcpdf_pagebreak]` shortcode).
|
185 |
|
3 |
Tags: woocommerce, booster for woocommerce, woocommerce jetpack
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 3.4.5
|
7 |
License: GNU General Public License v3.0
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
180 |
|
181 |
== Changelog ==
|
182 |
|
183 |
+
= 3.4.5 - 19/02/2018 =
|
184 |
+
* Fix - PRICES & CURRENCIES - Currency Exchange Rates - Crons - "Undefined index..." notices in log fixed.
|
185 |
+
* Dev - PRICES & CURRENCIES - Currency Exchange Rates - "Exchange Rates Offset (Percent)" options added for each currency pair.
|
186 |
+
* Dev - PRICES & CURRENCIES - Currency Exchange Rates - "Update all rates now" button added.
|
187 |
+
* Fix - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - Session init moved to the `init` hook (on "WC Sessions").
|
188 |
+
* Fix - PRICES & CURRENCIES - Prices and Currencies by Country - Session init moved to the `init` hook (on "WC Sessions").
|
189 |
+
* Dev - PRODUCTS - Product Listings - Admin Settings - Descriptions updated.
|
190 |
+
* Dev - PRODUCTS - Product Tabs - "Content Processing" option added.
|
191 |
+
* Dev - EMAILS & MISC. - General - "Session Type in Booster" option re-enabled.
|
192 |
+
* Dev - Speed Optimization - "WC Sessions" is now the default option for `WCJ_SESSION_TYPE`. Affected modules: Checkout Files Upload, EU VAT Number, Multicurrency (Currency Switcher), Product Visibility by Country, Product Custom Visibility, Tax Display, Prices and Currencies by Country.
|
193 |
+
* Dev - Code refactoring - Replaced some code with `wcj_is_frontend()`.
|
194 |
+
|
195 |
= 3.4.4 - 15/02/2018 =
|
196 |
* Fix - PDF INVOICING & PACKING SLIPS - `K_TCPDF_CALLS_IN_HTML` set to `true` (fixes the issue with using TCPDF methods in HTML, e.g. `[wcj_tcpdf_pagebreak]` shortcode).
|
197 |
|
woocommerce-jetpack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Booster for WooCommerce
|
4 |
Plugin URI: https://booster.io
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
-
Version: 3.4.
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: https://booster.io
|
9 |
Text Domain: woocommerce-jetpack
|
@@ -57,7 +57,7 @@ final class WC_Jetpack {
|
|
57 |
* @var string
|
58 |
* @since 2.4.7
|
59 |
*/
|
60 |
-
public $version = '3.4.
|
61 |
|
62 |
/**
|
63 |
* @var WC_Jetpack The single instance of the class
|
3 |
Plugin Name: Booster for WooCommerce
|
4 |
Plugin URI: https://booster.io
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
+
Version: 3.4.5
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: https://booster.io
|
9 |
Text Domain: woocommerce-jetpack
|
57 |
* @var string
|
58 |
* @since 2.4.7
|
59 |
*/
|
60 |
+
public $version = '3.4.5';
|
61 |
|
62 |
/**
|
63 |
* @var WC_Jetpack The single instance of the class
|