+ '',
+ 'css' => '',
+ 'value' => '',
+ 'class' => '',
+ 'name' => '',
+ 'suffix' => '',
+ 'desc_tip' => false,
+ 'desc' => '',
+ 'custom_attributes' => array(),
+ )
+ );
+ $args['value'] = wc_bool_to_string( $args['value'] );
+ $args['name'] = empty( $args['name'] ) ? $args['id'] : $args['name'];
+ // Description handling.
+ $field_description_data = \WC_Admin_Settings::get_field_description( $args );
+ ?>
+
+
+
+
+ $attribute_value ) {
+ echo esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '" ';
+ }
+ }
+ ?>
+ />
+ get_shipping_providers();
+ public static function migrate_to_configuration_sets( $providers_to_migrate = array() ) {
+ $providers = empty( $providers_to_migrate ) ? Helper::instance()->get_shipping_providers() : $providers_to_migrate;
+ $provider_ids = array();
foreach ( $providers as $provider ) {
if ( is_a( $provider, '\Vendidero\Germanized\Shipments\ShippingProvider\Auto' ) ) {
+ $provider_ids[] = $provider->get_id();
+
if ( is_callable( array( $provider, 'get_configuration_sets' ) ) ) {
$config_data = array();
@@ -173,6 +176,10 @@ public static function maybe_migrate_to_configuration_sets() {
$provider_name = $settings['shipping_provider'];
if ( $provider = wc_gzd_get_shipping_provider( $provider_name ) ) {
+ if ( ! in_array( $provider->get_id(), $provider_ids, true ) ) {
+ continue;
+ }
+
$settings_prefix = "{$provider_name}_";
$config_data = array();
@@ -202,10 +209,6 @@ public static function maybe_migrate_to_configuration_sets() {
}
}
- public static function get_excluded_methods() {
- return apply_filters( 'woocommerce_gzd_shipments_get_methods_excluded_from_provider_settings', array( 'pr_dhl_paket', 'flexible_shipping_info' ) );
- }
-
private static function update_providers() {
$providers = Helper::instance()->get_shipping_providers();
diff --git a/src/Interfaces/ShippingProvider.php b/src/Interfaces/ShippingProvider.php
index c725905f..80bcb52e 100644
--- a/src/Interfaces/ShippingProvider.php
+++ b/src/Interfaces/ShippingProvider.php
@@ -76,7 +76,7 @@ public function get_setting( $key, $default = null );
public function update_settings( $section = '', $data = null, $save = true );
- public function get_settings( $section = '', $for_shipping_method = false );
+ public function get_settings( $section = '' );
public function update_setting( $setting, $value );
diff --git a/src/Labels/ConfigurationSet.php b/src/Labels/ConfigurationSet.php
index 240c6043..299ab0d1 100644
--- a/src/Labels/ConfigurationSet.php
+++ b/src/Labels/ConfigurationSet.php
@@ -302,7 +302,12 @@ public function has_setting( $id ) {
$id = $details['suffix'] . '_' . $details['service_meta'];
}
- if ( array_key_exists( $id, $this->get_settings() ) ) {
+ $all_settings = $this->get_settings();
+ $the_setting = array_key_exists( $id, $all_settings ) ? $all_settings[ $id ] : null;
+
+ if ( 'product' === $id && '' === $the_setting ) {
+ return false;
+ } elseif ( ! is_null( $the_setting ) ) {
return true;
}
diff --git a/src/Labels/ConfigurationSetTrait.php b/src/Labels/ConfigurationSetTrait.php
index 3436d990..7f994bb3 100644
--- a/src/Labels/ConfigurationSetTrait.php
+++ b/src/Labels/ConfigurationSetTrait.php
@@ -235,7 +235,7 @@ public function reset_configuration_sets( $args = array() ) {
$configuration_sets = $this->get_configuration_sets( 'edit' );
foreach ( $configuration_sets as $set_id => $set ) {
- if ( substr( $set_id, 0, strlen( $id_prefix ) ) === $id_prefix ) {
+ if ( strstr( $set_id, $id_prefix ) ) {
unset( $configuration_sets[ $set_id ] );
}
}
diff --git a/src/Package.php b/src/Package.php
index 3891ee2f..d89fa331 100644
--- a/src/Package.php
+++ b/src/Package.php
@@ -153,6 +153,12 @@ public static function is_packing_supported() {
return version_compare( phpversion(), '7.1', '>=' ) && apply_filters( 'woocommerce_gzd_enable_rucksack_packaging', true );
}
+ public static function is_integration() {
+ $gzd_installed = class_exists( 'WooCommerce_Germanized' );
+
+ return $gzd_installed;
+ }
+
/**
* @return int[]
*/
diff --git a/src/ShippingMethod/ShippingMethod.php b/src/ShippingMethod/ShippingMethod.php
index 35a8fe48..eda110c2 100644
--- a/src/ShippingMethod/ShippingMethod.php
+++ b/src/ShippingMethod/ShippingMethod.php
@@ -209,12 +209,19 @@ public function init_form_fields() {
'default' => $this->method_title,
'desc_tip' => true,
),
+ 'free_title' => array(
+ 'title' => _x( 'Title (free shipping)', 'shipments', 'woocommerce-germanized-shipments' ),
+ 'type' => 'text',
+ 'description' => _x( 'This controls the title which the user sees during checkout in case a free shipping option is available.', 'shipments', 'woocommerce-germanized-shipments' ),
+ 'default' => sprintf( _x( 'Free shipping (via %1$s)', 'shipments', 'woocommerce-germanized-shipments' ), $this->method_title ),
+ 'desc_tip' => true,
+ ),
'shipping_rules_title' => array(
'title' => _x( 'Shipping Rules', 'shipments', 'woocommerce-germanized-shipments' ),
'type' => 'title',
'id' => 'shipping_rules_title',
'default' => '',
- 'description' => sprintf( _x( 'Configure shipping costs per packaging option. Within cart, a rucksack algorithm will automatically fit the items in the packaging option(s) available and calculate it\'s cost. Some important hints on the calculation logic:
The from value (e.g. 3) is expected to be inclusive (greater or equal 3). The to value (e.g. 5) is expected to be exclusive (smaller than 5).
Leave the to value empty for your last packaging rule to match all subsequent values.
In case a free shipping rule is available, the conditional logic automatically stops.
The all remaining packaging rules will be used for available packaging options without custom rules and serve as fallback in case no applicable rule was found.
In case no all remaining packaging rule exists, only packaging options with custom rules will be used for packing.
', 'shipments', 'woocommerce-germanized-shipments' ) ),
+ 'description' => sprintf( _x( 'Configure shipping costs per packaging option. Within cart, a rucksack algorithm will automatically fit the items in the packaging option(s) available and calculate it\'s cost. Some important hints on the calculation logic:
The from value (e.g. 3) is expected to be inclusive (greater or equal 3). The to value (e.g. 5) is expected to be exclusive (smaller than 5).
Leave the to value empty for your last packaging rule to match all subsequent values.
All conditions must be met for the shipping rule to apply.
In case a free shipping rule is available, the conditional logic automatically stops.
The all remaining packaging rules will be used for available packaging options without custom rules and serve as fallback in case no applicable rule was found.
In case no all remaining packaging rule exists, only packaging options with custom rules will be used for packing.