Version Description
- 2020-04-28 =
- Added integration with WooCommerce Multi-Currency plugin
Download this release
Release Info
Developer | wpdesk |
Plugin | Flexible Shipping for WooCommerce |
Version | 3.9.18 |
Comparing to | |
See all releases |
Code changes from version 3.9.17 to 3.9.18
- classes/class-flexible-shipping-plugin.php +3 -0
- classes/table-rate/multicurrency.php +20 -1
- classes/table-rate/shipping-method.php +7 -8
- classes/table-rate/views/html-ads.php +2 -0
- composer.lock +59 -14
- flexible-shipping.php +3 -3
- readme.txt +4 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +6 -0
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +10 -4
- vendor_prefixed/wpdesk/wc-currency-switchers-integrations/composer.json +35 -0
- vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/AbstractConverter.php +31 -0
- vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/ShippingIntegrations.php +45 -0
- vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/Converter.php +29 -0
- vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodController.php +86 -0
- vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodIntegration.php +47 -0
- vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/SwitcherConverter.php +29 -0
classes/class-flexible-shipping-plugin.php
CHANGED
@@ -18,6 +18,7 @@ use FSVendor\WPDesk\Tracker\Deactivation\TrackerFactory;
|
|
18 |
use FSVendor\WPDesk\View\Resolver\ChainResolver;
|
19 |
use FSVendor\WPDesk\View\Resolver\DirResolver;
|
20 |
use FSVendor\WPDesk\View\Resolver\WPThemeResolver;
|
|
|
21 |
use Psr\Log\LoggerInterface;
|
22 |
use Psr\Log\NullLogger;
|
23 |
|
@@ -165,6 +166,8 @@ class Flexible_Shipping_Plugin extends AbstractPlugin implements HookableCollect
|
|
165 |
|
166 |
$this->add_hookable( new WPDesk_Flexible_Shipping_Rest_Api_Order_Response_Data_Appender() );
|
167 |
|
|
|
|
|
168 |
$this->init_contextual_info();
|
169 |
|
170 |
}
|
18 |
use FSVendor\WPDesk\View\Resolver\ChainResolver;
|
19 |
use FSVendor\WPDesk\View\Resolver\DirResolver;
|
20 |
use FSVendor\WPDesk\View\Resolver\WPThemeResolver;
|
21 |
+
use FSVendor\WPDesk\WooCommerce\CurrencySwitchers\ShippingIntegrations;
|
22 |
use Psr\Log\LoggerInterface;
|
23 |
use Psr\Log\NullLogger;
|
24 |
|
166 |
|
167 |
$this->add_hookable( new WPDesk_Flexible_Shipping_Rest_Api_Order_Response_Data_Appender() );
|
168 |
|
169 |
+
$this->add_hookable( new ShippingIntegrations( 'flexible_shipping' ) );
|
170 |
+
|
171 |
$this->init_contextual_info();
|
172 |
|
173 |
}
|
classes/table-rate/multicurrency.php
CHANGED
@@ -4,6 +4,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
4 |
exit;
|
5 |
} // Exit if accessed directly
|
6 |
|
|
|
|
|
7 |
if ( ! class_exists( 'WPDesk_Flexible_Shipping_Multicurrency' ) ) {
|
8 |
|
9 |
class WPDesk_Flexible_Shipping_Multicurrency {
|
@@ -24,7 +26,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Multicurrency' ) ) {
|
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
-
*
|
28 |
*/
|
29 |
private function hooks() {
|
30 |
add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_wpml' ), 1 );
|
@@ -44,6 +46,10 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Multicurrency' ) ) {
|
|
44 |
if ( isset( $GLOBALS['WOOCS'] ) ) {
|
45 |
add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_woocs' ), 1 );
|
46 |
}
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -102,6 +108,19 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_Multicurrency' ) ) {
|
|
102 |
return $GLOBALS['WOOCS']->woocs_exchange_value( $value );
|
103 |
}
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
}
|
107 |
|
4 |
exit;
|
5 |
} // Exit if accessed directly
|
6 |
|
7 |
+
use FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency;
|
8 |
+
|
9 |
if ( ! class_exists( 'WPDesk_Flexible_Shipping_Multicurrency' ) ) {
|
10 |
|
11 |
class WPDesk_Flexible_Shipping_Multicurrency {
|
26 |
}
|
27 |
|
28 |
/**
|
29 |
+
* @TODO move this functionality to wpdesk/wc-currency-switchers-integrations library.
|
30 |
*/
|
31 |
private function hooks() {
|
32 |
add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_wpml' ), 1 );
|
46 |
if ( isset( $GLOBALS['WOOCS'] ) ) {
|
47 |
add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_woocs' ), 1 );
|
48 |
}
|
49 |
+
|
50 |
+
if ( class_exists( '\WOOMC\Price\Controller' ) ) {
|
51 |
+
add_filter( 'flexible_shipping_value_in_currency', array( $this, 'flexible_shipping_value_in_currency_woomc' ), 1 );
|
52 |
+
}
|
53 |
}
|
54 |
|
55 |
/**
|
108 |
return $GLOBALS['WOOCS']->woocs_exchange_value( $value );
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
* Convert value using WooCommerce Multicurrency switcher.
|
113 |
+
*
|
114 |
+
* @see https://woocommerce.com/products/multi-currency/
|
115 |
+
*
|
116 |
+
* @param float $value .
|
117 |
+
*
|
118 |
+
* @return float
|
119 |
+
*/
|
120 |
+
public function flexible_shipping_value_in_currency_woomc( $value ) {
|
121 |
+
$converter = new WooCommerceMultiCurrency\Converter();
|
122 |
+
return $converter->convert( $value );
|
123 |
+
}
|
124 |
|
125 |
}
|
126 |
|
classes/table-rate/shipping-method.php
CHANGED
@@ -113,8 +113,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
|
113 |
?>
|
114 |
</table>
|
115 |
<?php
|
116 |
-
|
117 |
-
include __DIR__ . '/views/html-ads.php';
|
118 |
?>
|
119 |
<h3 class="wc-settings-sub-title <?php echo esc_attr( $data['class'] ); ?>" id="<?php echo esc_attr( $field ); ?>"><?php echo wp_kses_post( $data['title'] ); ?>
|
120 |
<a href="<?php echo remove_query_arg( 'added', add_query_arg( 'action', 'new' ) ); ?>" class="add-new-h2"><?php echo __('Add New', 'flexible-shipping' ); ?></a></h3>
|
@@ -371,15 +370,15 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
|
371 |
}
|
372 |
|
373 |
public function admin_options() {
|
374 |
-
|
|
|
|
|
|
|
|
|
|
|
375 |
?>
|
376 |
<div class="<?php echo esc_html( $settings_div_class ) ; ?>"><table class="form-table">
|
377 |
<?php
|
378 |
-
$action = false;
|
379 |
-
if ( isset( $_GET['action'] ) )
|
380 |
-
{
|
381 |
-
$action = sanitize_key( $_GET['action'] );
|
382 |
-
}
|
383 |
if ( $action == 'new' || $action == 'edit' ) {
|
384 |
$shipping_methods = get_option( $this->shipping_methods_option, array() );
|
385 |
$shipping_method = array(
|
113 |
?>
|
114 |
</table>
|
115 |
<?php
|
116 |
+
include __DIR__ . '/views/html-ads.php';
|
|
|
117 |
?>
|
118 |
<h3 class="wc-settings-sub-title <?php echo esc_attr( $data['class'] ); ?>" id="<?php echo esc_attr( $field ); ?>"><?php echo wp_kses_post( $data['title'] ); ?>
|
119 |
<a href="<?php echo remove_query_arg( 'added', add_query_arg( 'action', 'new' ) ); ?>" class="add-new-h2"><?php echo __('Add New', 'flexible-shipping' ); ?></a></h3>
|
370 |
}
|
371 |
|
372 |
public function admin_options() {
|
373 |
+
$action = false;
|
374 |
+
if ( isset( $_GET['action'] ) )
|
375 |
+
{
|
376 |
+
$action = sanitize_key( $_GET['action'] );
|
377 |
+
}
|
378 |
+
$settings_div_class = in_array( $action, array( 'new', 'edit' ), true ) ? '' : 'fs-settings-div';
|
379 |
?>
|
380 |
<div class="<?php echo esc_html( $settings_div_class ) ; ?>"><table class="form-table">
|
381 |
<?php
|
|
|
|
|
|
|
|
|
|
|
382 |
if ( $action == 'new' || $action == 'edit' ) {
|
383 |
$shipping_methods = get_option( $this->shipping_methods_option, array() );
|
384 |
$shipping_method = array(
|
classes/table-rate/views/html-ads.php
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
<div class="fs-flexible-shipping-sidebar" style="height: auto;">
|
2 |
<div class="wpdesk-metabox">
|
3 |
<div class="wpdesk-stuffbox">
|
@@ -21,4 +22,5 @@
|
|
21 |
</div>
|
22 |
</div>
|
23 |
</div>
|
|
|
24 |
<div class="clear"></div>
|
1 |
+
<?php if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) ) : ?>
|
2 |
<div class="fs-flexible-shipping-sidebar" style="height: auto;">
|
3 |
<div class="wpdesk-metabox">
|
4 |
<div class="wpdesk-stuffbox">
|
22 |
</div>
|
23 |
</div>
|
24 |
</div>
|
25 |
+
<?php endif; ?>
|
26 |
<div class="clear"></div>
|
composer.lock
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
-
"content-hash": "
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "psr/log",
|
@@ -5730,20 +5730,20 @@
|
|
5730 |
},
|
5731 |
{
|
5732 |
"name": "wp-cli/db-command",
|
5733 |
-
"version": "v2.0.
|
5734 |
"source": {
|
5735 |
"type": "git",
|
5736 |
"url": "https://github.com/wp-cli/db-command.git",
|
5737 |
-
"reference": "
|
5738 |
},
|
5739 |
"dist": {
|
5740 |
"type": "zip",
|
5741 |
-
"url": "https://api.github.com/repos/wp-cli/db-command/zipball/
|
5742 |
-
"reference": "
|
5743 |
"shasum": ""
|
5744 |
},
|
5745 |
"require": {
|
5746 |
-
"wp-cli/wp-cli": "
|
5747 |
},
|
5748 |
"require-dev": {
|
5749 |
"wp-cli/entity-command": "^1.3 || ^2",
|
@@ -5796,7 +5796,7 @@
|
|
5796 |
],
|
5797 |
"description": "Performs basic database operations using credentials stored in wp-config.php.",
|
5798 |
"homepage": "https://github.com/wp-cli/db-command",
|
5799 |
-
"time": "2020-
|
5800 |
},
|
5801 |
{
|
5802 |
"name": "wp-cli/embed-command",
|
@@ -7200,16 +7200,16 @@
|
|
7200 |
},
|
7201 |
{
|
7202 |
"name": "wp-cli/wp-cli",
|
7203 |
-
"version": "
|
7204 |
"source": {
|
7205 |
"type": "git",
|
7206 |
"url": "https://github.com/wp-cli/wp-cli.git",
|
7207 |
-
"reference": "
|
7208 |
},
|
7209 |
"dist": {
|
7210 |
"type": "zip",
|
7211 |
-
"url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/
|
7212 |
-
"reference": "
|
7213 |
"shasum": ""
|
7214 |
},
|
7215 |
"require": {
|
@@ -7240,7 +7240,7 @@
|
|
7240 |
"type": "library",
|
7241 |
"extra": {
|
7242 |
"branch-alias": {
|
7243 |
-
"dev-master": "2.
|
7244 |
}
|
7245 |
},
|
7246 |
"autoload": {
|
@@ -7258,7 +7258,7 @@
|
|
7258 |
"cli",
|
7259 |
"wordpress"
|
7260 |
],
|
7261 |
-
"time": "2020-
|
7262 |
},
|
7263 |
{
|
7264 |
"name": "wp-cli/wp-cli-bundle",
|
@@ -7416,6 +7416,51 @@
|
|
7416 |
],
|
7417 |
"time": "2020-02-04T02:52:06+00:00"
|
7418 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7419 |
{
|
7420 |
"name": "wpdesk/wp-abtesting",
|
7421 |
"version": "1.1.0",
|
@@ -8339,7 +8384,7 @@
|
|
8339 |
}
|
8340 |
],
|
8341 |
"aliases": [],
|
8342 |
-
"minimum-stability": "
|
8343 |
"stability-flags": [],
|
8344 |
"prefer-stable": true,
|
8345 |
"prefer-lowest": false,
|
4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
+
"content-hash": "4ea66ebc39d866b17b973f0568340f05",
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "psr/log",
|
5730 |
},
|
5731 |
{
|
5732 |
"name": "wp-cli/db-command",
|
5733 |
+
"version": "v2.0.8",
|
5734 |
"source": {
|
5735 |
"type": "git",
|
5736 |
"url": "https://github.com/wp-cli/db-command.git",
|
5737 |
+
"reference": "b56e5666a9b9b7a9a9767d3d61ee3b50e0af18a5"
|
5738 |
},
|
5739 |
"dist": {
|
5740 |
"type": "zip",
|
5741 |
+
"url": "https://api.github.com/repos/wp-cli/db-command/zipball/b56e5666a9b9b7a9a9767d3d61ee3b50e0af18a5",
|
5742 |
+
"reference": "b56e5666a9b9b7a9a9767d3d61ee3b50e0af18a5",
|
5743 |
"shasum": ""
|
5744 |
},
|
5745 |
"require": {
|
5746 |
+
"wp-cli/wp-cli": "dev-master"
|
5747 |
},
|
5748 |
"require-dev": {
|
5749 |
"wp-cli/entity-command": "^1.3 || ^2",
|
5796 |
],
|
5797 |
"description": "Performs basic database operations using credentials stored in wp-config.php.",
|
5798 |
"homepage": "https://github.com/wp-cli/db-command",
|
5799 |
+
"time": "2020-04-18T13:34:09+00:00"
|
5800 |
},
|
5801 |
{
|
5802 |
"name": "wp-cli/embed-command",
|
7200 |
},
|
7201 |
{
|
7202 |
"name": "wp-cli/wp-cli",
|
7203 |
+
"version": "dev-master",
|
7204 |
"source": {
|
7205 |
"type": "git",
|
7206 |
"url": "https://github.com/wp-cli/wp-cli.git",
|
7207 |
+
"reference": "6d4b6136f42e6aa01343294776c7be59dd5973b4"
|
7208 |
},
|
7209 |
"dist": {
|
7210 |
"type": "zip",
|
7211 |
+
"url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/6d4b6136f42e6aa01343294776c7be59dd5973b4",
|
7212 |
+
"reference": "6d4b6136f42e6aa01343294776c7be59dd5973b4",
|
7213 |
"shasum": ""
|
7214 |
},
|
7215 |
"require": {
|
7240 |
"type": "library",
|
7241 |
"extra": {
|
7242 |
"branch-alias": {
|
7243 |
+
"dev-master": "2.5.x-dev"
|
7244 |
}
|
7245 |
},
|
7246 |
"autoload": {
|
7258 |
"cli",
|
7259 |
"wordpress"
|
7260 |
],
|
7261 |
+
"time": "2020-04-18T05:07:54+00:00"
|
7262 |
},
|
7263 |
{
|
7264 |
"name": "wp-cli/wp-cli-bundle",
|
7416 |
],
|
7417 |
"time": "2020-02-04T02:52:06+00:00"
|
7418 |
},
|
7419 |
+
{
|
7420 |
+
"name": "wpdesk/wc-currency-switchers-integrations",
|
7421 |
+
"version": "1.0.0",
|
7422 |
+
"source": {
|
7423 |
+
"type": "git",
|
7424 |
+
"url": "https://gitlab.com/wpdesk/wc-currency-switchers-integrations.git",
|
7425 |
+
"reference": "03258663525263d3d5fb1c3806e51924e0d4c56d"
|
7426 |
+
},
|
7427 |
+
"dist": {
|
7428 |
+
"type": "zip",
|
7429 |
+
"url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwc-currency-switchers-integrations/repository/archive.zip?sha=03258663525263d3d5fb1c3806e51924e0d4c56d",
|
7430 |
+
"reference": "03258663525263d3d5fb1c3806e51924e0d4c56d",
|
7431 |
+
"shasum": ""
|
7432 |
+
},
|
7433 |
+
"require": {
|
7434 |
+
"php": ">=5.6",
|
7435 |
+
"psr/container": "^1.0",
|
7436 |
+
"wpdesk/wp-plugin-flow": "^2.6"
|
7437 |
+
},
|
7438 |
+
"require-dev": {
|
7439 |
+
"10up/wp_mock": "*",
|
7440 |
+
"mockery/mockery": "*",
|
7441 |
+
"phpunit/phpunit": "^5",
|
7442 |
+
"squizlabs/php_codesniffer": "^3.0.2",
|
7443 |
+
"wimg/php-compatibility": "^8",
|
7444 |
+
"wp-coding-standards/wpcs": "^0.14.1"
|
7445 |
+
},
|
7446 |
+
"type": "library",
|
7447 |
+
"autoload": {
|
7448 |
+
"psr-4": {
|
7449 |
+
"WPDesk\\WooCommerce\\CurrencySwitchers\\": "src/"
|
7450 |
+
}
|
7451 |
+
},
|
7452 |
+
"notification-url": "https://packagist.org/downloads/",
|
7453 |
+
"license": [
|
7454 |
+
"MIT"
|
7455 |
+
],
|
7456 |
+
"authors": [
|
7457 |
+
{
|
7458 |
+
"name": "Grzegorz",
|
7459 |
+
"email": "grola@wpdesk.pl"
|
7460 |
+
}
|
7461 |
+
],
|
7462 |
+
"time": "2020-04-28T13:48:24+00:00"
|
7463 |
+
},
|
7464 |
{
|
7465 |
"name": "wpdesk/wp-abtesting",
|
7466 |
"version": "1.1.0",
|
8384 |
}
|
8385 |
],
|
8386 |
"aliases": [],
|
8387 |
+
"minimum-stability": "dev",
|
8388 |
"stability-flags": [],
|
8389 |
"prefer-stable": true,
|
8390 |
"prefer-lowest": false,
|
flexible-shipping.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Flexible Shipping
|
4 |
* Plugin URI: https://wordpress.org/plugins/flexible-shipping/
|
5 |
* Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
|
6 |
-
* Version: 3.9.
|
7 |
* Author: WP Desk
|
8 |
* Author URI: https://www.wpdesk.net/
|
9 |
* Text Domain: flexible-shipping
|
@@ -38,8 +38,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
38 |
} // Exit if accessed directly
|
39 |
|
40 |
/* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
|
41 |
-
$plugin_version = '3.9.
|
42 |
-
$plugin_release_timestamp = '2020-04-
|
43 |
|
44 |
$plugin_name = 'Flexible Shipping';
|
45 |
$product_id = 'Flexible Shipping';
|
3 |
* Plugin Name: Flexible Shipping
|
4 |
* Plugin URI: https://wordpress.org/plugins/flexible-shipping/
|
5 |
* Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
|
6 |
+
* Version: 3.9.18
|
7 |
* Author: WP Desk
|
8 |
* Author URI: https://www.wpdesk.net/
|
9 |
* Text Domain: flexible-shipping
|
38 |
} // Exit if accessed directly
|
39 |
|
40 |
/* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
|
41 |
+
$plugin_version = '3.9.18';
|
42 |
+
$plugin_release_timestamp = '2020-04-29 09:34';
|
43 |
|
44 |
$plugin_name = 'Flexible Shipping';
|
45 |
$product_id = 'Flexible Shipping';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flexibleshipping.com/table-rate/
|
|
4 |
Tags: table rate, table rate shipping, conditional shipping, shipping method, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.4
|
7 |
-
Stable tag: 3.9.
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -171,6 +171,9 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
|
|
171 |
|
172 |
== Changelog ==
|
173 |
|
|
|
|
|
|
|
174 |
= 3.9.17 - 2020-04-24 =
|
175 |
* Added Beacon functionality for Flexible Shipping PRO
|
176 |
* Changed PRO advertising
|
4 |
Tags: table rate, table rate shipping, conditional shipping, shipping method, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.4
|
7 |
+
Stable tag: 3.9.18
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
171 |
|
172 |
== Changelog ==
|
173 |
|
174 |
+
= 3.9.18 - 2020-04-28 =
|
175 |
+
* Added integration with WooCommerce Multi-Currency plugin
|
176 |
+
|
177 |
= 3.9.17 - 2020-04-24 =
|
178 |
* Added Beacon functionality for Flexible Shipping PRO
|
179 |
* Changed PRO advertising
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit392c5757d24484ff121921ee97587055::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -221,6 +221,12 @@ return array(
|
|
221 |
'FSVendor\\WPDesk\\View\\Resolver\\NullResolver' => $baseDir . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/NullResolver.php',
|
222 |
'FSVendor\\WPDesk\\View\\Resolver\\Resolver' => $baseDir . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/Resolver.php',
|
223 |
'FSVendor\\WPDesk\\View\\Resolver\\WPThemeResolver' => $baseDir . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/WPThemeResolver.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
'FSVendor\\WPDesk_API_KEY' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php',
|
225 |
'FSVendor\\WPDesk_API_MENU' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-menu.php',
|
226 |
'FSVendor\\WPDesk_API_Manager_With_Update_Flag' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager.php',
|
221 |
'FSVendor\\WPDesk\\View\\Resolver\\NullResolver' => $baseDir . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/NullResolver.php',
|
222 |
'FSVendor\\WPDesk\\View\\Resolver\\Resolver' => $baseDir . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/Resolver.php',
|
223 |
'FSVendor\\WPDesk\\View\\Resolver\\WPThemeResolver' => $baseDir . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/WPThemeResolver.php',
|
224 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\AbstractConverter' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/AbstractConverter.php',
|
225 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\ShippingIntegrations' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/ShippingIntegrations.php',
|
226 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\SwitcherConverter' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/SwitcherConverter.php',
|
227 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\Converter' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/Converter.php',
|
228 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodController' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodController.php',
|
229 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodIntegration' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodIntegration.php',
|
230 |
'FSVendor\\WPDesk_API_KEY' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php',
|
231 |
'FSVendor\\WPDesk_API_MENU' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-menu.php',
|
232 |
'FSVendor\\WPDesk_API_Manager_With_Update_Flag' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager.php',
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit1c58ffcecd0c6a4ac17febc916c815e3
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit392c5757d24484ff121921ee97587055
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit392c5757d24484ff121921ee97587055', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit392c5757d24484ff121921ee97587055', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit392c5757d24484ff121921ee97587055::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'P' =>
|
@@ -236,6 +236,12 @@ class ComposerStaticInit1c58ffcecd0c6a4ac17febc916c815e3
|
|
236 |
'FSVendor\\WPDesk\\View\\Resolver\\NullResolver' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/NullResolver.php',
|
237 |
'FSVendor\\WPDesk\\View\\Resolver\\Resolver' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/Resolver.php',
|
238 |
'FSVendor\\WPDesk\\View\\Resolver\\WPThemeResolver' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/WPThemeResolver.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
'FSVendor\\WPDesk_API_KEY' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php',
|
240 |
'FSVendor\\WPDesk_API_MENU' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-menu.php',
|
241 |
'FSVendor\\WPDesk_API_Manager_With_Update_Flag' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager.php',
|
@@ -364,9 +370,9 @@ class ComposerStaticInit1c58ffcecd0c6a4ac17febc916c815e3
|
|
364 |
public static function getInitializer(ClassLoader $loader)
|
365 |
{
|
366 |
return \Closure::bind(function () use ($loader) {
|
367 |
-
$loader->prefixLengthsPsr4 =
|
368 |
-
$loader->prefixDirsPsr4 =
|
369 |
-
$loader->classMap =
|
370 |
|
371 |
}, null, ClassLoader::class);
|
372 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit392c5757d24484ff121921ee97587055
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'P' =>
|
236 |
'FSVendor\\WPDesk\\View\\Resolver\\NullResolver' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/NullResolver.php',
|
237 |
'FSVendor\\WPDesk\\View\\Resolver\\Resolver' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/Resolver.php',
|
238 |
'FSVendor\\WPDesk\\View\\Resolver\\WPThemeResolver' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-view/src/Resolver/WPThemeResolver.php',
|
239 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\AbstractConverter' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/AbstractConverter.php',
|
240 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\ShippingIntegrations' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/ShippingIntegrations.php',
|
241 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\SwitcherConverter' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/SwitcherConverter.php',
|
242 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\Converter' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/Converter.php',
|
243 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodController' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodController.php',
|
244 |
+
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodIntegration' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodIntegration.php',
|
245 |
'FSVendor\\WPDesk_API_KEY' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php',
|
246 |
'FSVendor\\WPDesk_API_MENU' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-menu.php',
|
247 |
'FSVendor\\WPDesk_API_Manager_With_Update_Flag' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager.php',
|
370 |
public static function getInitializer(ClassLoader $loader)
|
371 |
{
|
372 |
return \Closure::bind(function () use ($loader) {
|
373 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit392c5757d24484ff121921ee97587055::$prefixLengthsPsr4;
|
374 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit392c5757d24484ff121921ee97587055::$prefixDirsPsr4;
|
375 |
+
$loader->classMap = ComposerStaticInit392c5757d24484ff121921ee97587055::$classMap;
|
376 |
|
377 |
}, null, ClassLoader::class);
|
378 |
}
|
vendor_prefixed/wpdesk/wc-currency-switchers-integrations/composer.json
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "wpdesk\/wc-currency-switchers-integrations",
|
3 |
+
"authors": [
|
4 |
+
{
|
5 |
+
"name": "Grzegorz",
|
6 |
+
"email": "grola@wpdesk.pl"
|
7 |
+
}
|
8 |
+
],
|
9 |
+
"license": "MIT",
|
10 |
+
"require": {
|
11 |
+
"php": ">=5.6",
|
12 |
+
"psr\/container": "^1.0",
|
13 |
+
"wpdesk\/wp-plugin-flow": "^2.6"
|
14 |
+
},
|
15 |
+
"require-dev": {
|
16 |
+
"phpunit\/phpunit": "^5",
|
17 |
+
"wp-coding-standards\/wpcs": "^0.14.1",
|
18 |
+
"squizlabs\/php_codesniffer": "^3.0.2",
|
19 |
+
"wimg\/php-compatibility": "^8",
|
20 |
+
"mockery\/mockery": "*",
|
21 |
+
"10up\/wp_mock": "*"
|
22 |
+
},
|
23 |
+
"autoload": {
|
24 |
+
"psr-4": {
|
25 |
+
"FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\": "src\/"
|
26 |
+
}
|
27 |
+
},
|
28 |
+
"autoload-dev": {},
|
29 |
+
"scripts": {
|
30 |
+
"phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never",
|
31 |
+
"phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage",
|
32 |
+
"phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never",
|
33 |
+
"phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage"
|
34 |
+
}
|
35 |
+
}
|
vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/AbstractConverter.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Abstract converter.
|
5 |
+
*
|
6 |
+
* @package WPDesk\WooCommerce\CurrencySwitchers
|
7 |
+
*/
|
8 |
+
namespace FSVendor\WPDesk\WooCommerce\CurrencySwitchers;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Abstract class for converters.
|
12 |
+
*/
|
13 |
+
abstract class AbstractConverter implements \FSVendor\WPDesk\WooCommerce\CurrencySwitchers\SwitcherConverter
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* @inheritDoc
|
17 |
+
*/
|
18 |
+
abstract function convert($value);
|
19 |
+
/**
|
20 |
+
* @inheritDoc
|
21 |
+
*/
|
22 |
+
public function convert_array($values)
|
23 |
+
{
|
24 |
+
foreach ($values as $key => $value) {
|
25 |
+
if ($value) {
|
26 |
+
$values[$key] = $this->convert($value);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
return $values;
|
30 |
+
}
|
31 |
+
}
|
vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/ShippingIntegrations.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Shipping integrations.
|
5 |
+
*
|
6 |
+
* @package WPDesk\WooCommerce\CurrencySwitchers
|
7 |
+
*/
|
8 |
+
namespace FSVendor\WPDesk\WooCommerce\CurrencySwitchers;
|
9 |
+
|
10 |
+
use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
11 |
+
use FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency\ShippingMethodIntegration;
|
12 |
+
/**
|
13 |
+
* Can create integrations for shipping methods.
|
14 |
+
* Creates integrations for plugins which do not works by default, ie. WooCommerce MultiCurrency.
|
15 |
+
* @see https://woocommerce.com/products/multi-currency/
|
16 |
+
*/
|
17 |
+
class ShippingIntegrations implements \FSVendor\WPDesk\PluginBuilder\Plugin\Hookable
|
18 |
+
{
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
private $shipping_method_id;
|
23 |
+
/**
|
24 |
+
* @param string $shipping_method_id .
|
25 |
+
*/
|
26 |
+
public function __construct($shipping_method_id)
|
27 |
+
{
|
28 |
+
$this->shipping_method_id = $shipping_method_id;
|
29 |
+
}
|
30 |
+
/**
|
31 |
+
* Hooks.
|
32 |
+
*/
|
33 |
+
public function hooks()
|
34 |
+
{
|
35 |
+
\add_action('woocommerce_loaded', array($this, 'add_integrations_for_shipping_method'));
|
36 |
+
}
|
37 |
+
/**
|
38 |
+
* Add integration to WooCommerce MultiCurrency for shipping method.
|
39 |
+
*/
|
40 |
+
public function add_integrations_for_shipping_method()
|
41 |
+
{
|
42 |
+
$woocommerce_multicurrency_integration = new \FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency\ShippingMethodIntegration($this->shipping_method_id);
|
43 |
+
$woocommerce_multicurrency_integration->hooks();
|
44 |
+
}
|
45 |
+
}
|
vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/Converter.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Currency converter.
|
5 |
+
*
|
6 |
+
* @package WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency
|
7 |
+
*/
|
8 |
+
namespace FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency;
|
9 |
+
|
10 |
+
use FSVendor\WPDesk\WooCommerce\CurrencySwitchers\AbstractConverter;
|
11 |
+
/**
|
12 |
+
* Can convert currency using WooCommerce MultiCurrency plugin.
|
13 |
+
* @see https://woocommerce.com/products/multi-currency/
|
14 |
+
*/
|
15 |
+
class Converter extends \FSVendor\WPDesk\WooCommerce\CurrencySwitchers\AbstractConverter
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @inheritDoc
|
19 |
+
*/
|
20 |
+
public function convert($value)
|
21 |
+
{
|
22 |
+
$rate_storage = new \WOOMC\Rate\Storage();
|
23 |
+
$price_rounder = new \WOOMC\Price\Rounder();
|
24 |
+
$currency_detector = new \WOOMC\Currency\Detector();
|
25 |
+
$price_calculator = new \WOOMC\Price\Calculator($rate_storage, $price_rounder);
|
26 |
+
$price_controller = new \WOOMC\Price\Controller($price_calculator, $currency_detector);
|
27 |
+
return $price_controller->convert($value);
|
28 |
+
}
|
29 |
+
}
|
vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodController.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Shipping method controler.
|
5 |
+
*
|
6 |
+
* @package WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency
|
7 |
+
*/
|
8 |
+
namespace FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency;
|
9 |
+
|
10 |
+
use FSVendor\WP_Mock\Hook;
|
11 |
+
use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
12 |
+
/**
|
13 |
+
* Converts shipping costs and taxes from shop currency to current currency.
|
14 |
+
*/
|
15 |
+
class ShippingMethodController implements \FSVendor\WPDesk\PluginBuilder\Plugin\Hookable
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
private $shipping_method_id;
|
21 |
+
/**
|
22 |
+
*
|
23 |
+
* @var Converter
|
24 |
+
*/
|
25 |
+
protected $converter;
|
26 |
+
/**
|
27 |
+
* @param string $shipping_method_id .
|
28 |
+
* @param Converter $converter .
|
29 |
+
*/
|
30 |
+
public function __construct($shipping_method_id, $converter)
|
31 |
+
{
|
32 |
+
$this->shipping_method_id = $shipping_method_id;
|
33 |
+
$this->converter = $converter;
|
34 |
+
}
|
35 |
+
/**
|
36 |
+
* Hooks.
|
37 |
+
*/
|
38 |
+
public function hooks()
|
39 |
+
{
|
40 |
+
\add_filter('woocommerce_shipping_rate_cost', array($this, 'convert_shipping_rate_costs_for_shipping_method'), 10, 2);
|
41 |
+
\add_filter('woocommerce_shipping_rate_taxes', array($this, 'convert_shipping_rate_taxes_for_shipping_method'), 10, 2);
|
42 |
+
}
|
43 |
+
/**
|
44 |
+
* Filter the rate cost.
|
45 |
+
*
|
46 |
+
* @param float|int|string $cost The shipping rate cost.
|
47 |
+
* @param \WC_Shipping_Rate $shipping_rate_object The shipping rate object.
|
48 |
+
*
|
49 |
+
* @return float|int|string
|
50 |
+
* @internal filter.
|
51 |
+
*/
|
52 |
+
public function convert_shipping_rate_costs_for_shipping_method($cost, $shipping_rate_object)
|
53 |
+
{
|
54 |
+
if ($this->is_shipping_method($shipping_rate_object)) {
|
55 |
+
$cost = $this->converter->convert($cost);
|
56 |
+
}
|
57 |
+
return $cost;
|
58 |
+
}
|
59 |
+
/**
|
60 |
+
* Filter the taxes.
|
61 |
+
*
|
62 |
+
* @param float[]|int[]|string[] $taxes The shipping rate taxes array.
|
63 |
+
* @param \WC_Shipping_Rate $shipping_rate_object The shipping rate object.
|
64 |
+
*
|
65 |
+
* @return float[]|int[]|string[]
|
66 |
+
* @internal filter.
|
67 |
+
*/
|
68 |
+
public function convert_shipping_rate_taxes_for_shipping_method($taxes, $shipping_rate_object)
|
69 |
+
{
|
70 |
+
if ($this->is_shipping_method($shipping_rate_object)) {
|
71 |
+
$taxes = $this->converter->convert_array($taxes);
|
72 |
+
}
|
73 |
+
return $taxes;
|
74 |
+
}
|
75 |
+
/**
|
76 |
+
* Check if the shipping rate object's method ID is relevant to this class.
|
77 |
+
*
|
78 |
+
* @param \WC_Shipping_Rate $shipping_rate_object The shipping rate object.
|
79 |
+
*
|
80 |
+
* @return bool
|
81 |
+
*/
|
82 |
+
private function is_shipping_method($shipping_rate_object)
|
83 |
+
{
|
84 |
+
return $shipping_rate_object instanceof \WC_Shipping_Rate && $this->shipping_method_id === $shipping_rate_object->get_method_id();
|
85 |
+
}
|
86 |
+
}
|
vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodIntegration.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Shipping method integration.
|
5 |
+
*
|
6 |
+
* @package WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency
|
7 |
+
*/
|
8 |
+
namespace FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency;
|
9 |
+
|
10 |
+
use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
11 |
+
/**
|
12 |
+
* Integrates shipping method (by method_id, ie.: flexible_shipping ) with WooCommerce Multicurrency plugin.
|
13 |
+
* @see https://woocommerce.com/products/multi-currency/
|
14 |
+
*/
|
15 |
+
class ShippingMethodIntegration implements \FSVendor\WPDesk\PluginBuilder\Plugin\Hookable
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
private $shipping_method_id;
|
21 |
+
/**
|
22 |
+
* @var \WOOMC\Integration\Shipping\AbstractController
|
23 |
+
*/
|
24 |
+
private $woocommerce_multicurrency_controller;
|
25 |
+
/**
|
26 |
+
* @param string $shipping_method_id .
|
27 |
+
*/
|
28 |
+
public function __construct($shipping_method_id)
|
29 |
+
{
|
30 |
+
$this->shipping_method_id = $shipping_method_id;
|
31 |
+
}
|
32 |
+
/**
|
33 |
+
* Hooks.
|
34 |
+
*/
|
35 |
+
public function hooks()
|
36 |
+
{
|
37 |
+
\add_action('woocommerce_multicurrency_loaded', array($this, 'add_integration_for_shipping_method'));
|
38 |
+
}
|
39 |
+
/**
|
40 |
+
* Add integration to WooCommerce MultiCurrency for shipping method.
|
41 |
+
*/
|
42 |
+
public function add_integration_for_shipping_method()
|
43 |
+
{
|
44 |
+
$this->woocommerce_multicurrency_controller = new \FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency\ShippingMethodController($this->shipping_method_id, new \FSVendor\WPDesk\WooCommerce\CurrencySwitchers\Switcher\WooCommerceMultiCurrency\Converter());
|
45 |
+
$this->woocommerce_multicurrency_controller->hooks();
|
46 |
+
}
|
47 |
+
}
|
vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/SwitcherConverter.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Interface Converter
|
5 |
+
* @package WPDesk\WooCommerce\CurrencySwitchers
|
6 |
+
*/
|
7 |
+
namespace FSVendor\WPDesk\WooCommerce\CurrencySwitchers;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Interface for currency switchers converters.
|
11 |
+
*/
|
12 |
+
interface SwitcherConverter
|
13 |
+
{
|
14 |
+
/**
|
15 |
+
* Convert value from shop currency to current currency.
|
16 |
+
*
|
17 |
+
* @param float $value Value in shop currency.
|
18 |
+
*
|
19 |
+
* @return float
|
20 |
+
*/
|
21 |
+
public function convert($value);
|
22 |
+
/**
|
23 |
+
* Convert an array of prices.
|
24 |
+
*
|
25 |
+
* @return array
|
26 |
+
* @example convert_array( ['price' => '10', 'sale_price' => 5] ) --> ['price' => '12.4', 'sale_price' => 6.2]
|
27 |
+
*/
|
28 |
+
public function convert_array($values);
|
29 |
+
}
|