Skip to content

Commit 5d92cfb

Browse files
committed
Improve (variable) bundles price label compatibility. Prevent (re) scheduling shiptastic install notice after 4.0.0.
1 parent 10351a4 commit 5d92cfb

9 files changed

+78
-48
lines changed
0 Bytes
Binary file not shown.

i18n/languages/woocommerce-germanized-de_DE.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ msgstr ""
44
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-"
55
"germanized\n"
66
"POT-Creation-Date: 2026-04-08T08:41:06+00:00\n"
7-
"PO-Revision-Date: 2026-04-09 20:21+0200\n"
7+
"PO-Revision-Date: 2026-04-10 14:22+0200\n"
88
"Last-Translator: Dennis Nissle <info@vendidero.de>\n"
99
"Language-Team: \n"
1010
"Language: de_DE\n"
@@ -1240,9 +1240,9 @@ msgid ""
12401240
"questions regarding one of your orders, please <a href=\"%s\">contact "
12411241
"support</a> for help."
12421242
msgstr ""
1243-
"Leider konnten wir anhand der von dir angegeben Daten keine Bestellung "
1244-
"finden. Falls du weiterhin Probleme hast, <a href=\"%s\">kontaktiere</a> "
1245-
"bitte unseren Support."
1243+
"Derzeit stehen keine Bestellungen für den Widerruf zur Verfügung. Falls du "
1244+
"Fragen zu deinen Bestellungen hast, <a href=\"%s\">kontaktiere</a> bitte "
1245+
"unseren Support."
12461246

12471247
#: templates/forms/order-withdrawal-request.php:149
12481248
#: packages/eu-order-withdrawal-button-for-woocommerce/templates/forms/order-withdrawal-request.php:149
-3 Bytes
Binary file not shown.

i18n/languages/woocommerce-germanized-de_DE_formal.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ msgstr ""
44
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-"
55
"germanized\n"
66
"POT-Creation-Date: 2026-04-08T08:41:06+00:00\n"
7-
"PO-Revision-Date: 2026-04-09 20:21+0200\n"
7+
"PO-Revision-Date: 2026-04-10 14:22+0200\n"
88
"Last-Translator: Dennis Nissle <info@vendidero.de>\n"
99
"Language-Team: \n"
1010
"Language: de_DE@formal\n"
@@ -1241,9 +1241,9 @@ msgid ""
12411241
"questions regarding one of your orders, please <a href=\"%s\">contact "
12421242
"support</a> for help."
12431243
msgstr ""
1244-
"Leider konnten wir anhand der von Ihnen angegeben Daten keine Bestellung "
1245-
"finden. Falls Sie weiterhin Probleme haben, <a href=\"%s\">kontaktieren</a> "
1246-
"Sie bitte unseren Support."
1244+
"Derzeit stehen keine Bestellungen für den Widerruf zur Verfügung. Falls Sie "
1245+
"Fragen zu Ihren Bestellungen haben, <a href=\"%s\">kontaktieren</a> Sie "
1246+
"bitte unseren Support."
12471247

12481248
#: templates/forms/order-withdrawal-request.php:149
12491249
#: packages/eu-order-withdrawal-button-for-woocommerce/templates/forms/order-withdrawal-request.php:149

includes/class-wc-gzd-install.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -584,17 +584,19 @@ public static function install() {
584584
// Delete plugin header data for dependency check
585585
delete_option( 'woocommerce_gzd_plugin_header_data' );
586586

587-
if ( ! \Vendidero\Germanized\PluginsHelper::is_shiptastic_plugin_active() && \Vendidero\Germanized\Shiptastic::needs_shiptastic_standalone() ) {
588-
update_option( 'woocommerce_gzd_is_shiptastic_standalone_update', 'yes' );
589-
} else {
590-
delete_option( 'woocommerce_gzd_is_shiptastic_standalone_update' );
591-
}
587+
if ( ! is_null( $current_version ) && version_compare( $current_version, '4.0.0', '<' ) ) {
588+
if ( ! \Vendidero\Germanized\PluginsHelper::is_shiptastic_plugin_active() && \Vendidero\Germanized\Shiptastic::needs_shiptastic_standalone() ) {
589+
update_option( 'woocommerce_gzd_is_shiptastic_standalone_update', 'yes' );
590+
} else {
591+
delete_option( 'woocommerce_gzd_is_shiptastic_standalone_update' );
592+
}
592593

593-
if ( ! \Vendidero\Germanized\PluginsHelper::is_shiptastic_dhl_plugin_active() && \Vendidero\Germanized\Shiptastic::needs_shiptastic_dhl_standalone() ) {
594-
update_option( 'woocommerce_gzd_is_shiptastic_standalone_update', 'yes' );
595-
update_option( 'woocommerce_gzd_is_shiptastic_dhl_standalone_update', 'yes' );
596-
} else {
597-
delete_option( 'woocommerce_gzd_is_shiptastic_dhl_standalone_update' );
594+
if ( ! \Vendidero\Germanized\PluginsHelper::is_shiptastic_dhl_plugin_active() && \Vendidero\Germanized\Shiptastic::needs_shiptastic_dhl_standalone() ) {
595+
update_option( 'woocommerce_gzd_is_shiptastic_standalone_update', 'yes' );
596+
update_option( 'woocommerce_gzd_is_shiptastic_dhl_standalone_update', 'yes' );
597+
} else {
598+
delete_option( 'woocommerce_gzd_is_shiptastic_dhl_standalone_update' );
599+
}
598600
}
599601

600602
include_once WC_GERMANIZED_ABSPATH . 'includes/admin/class-wc-gzd-admin-notices.php';
@@ -607,9 +609,13 @@ public static function install() {
607609
$note->reset();
608610
}
609611

610-
// Recheck Shiptastic install
611-
if ( $note = $notices->get_note( 'shiptastic_install' ) ) {
612-
$note->reset();
612+
/**
613+
* Recheck Shiptastic install when updating to 4.0.
614+
*/
615+
if ( ! is_null( $current_version ) && version_compare( $current_version, '4.0.0', '<' ) ) {
616+
if ( $note = $notices->get_note( 'shiptastic_install' ) ) {
617+
$note->reset();
618+
}
613619
}
614620

615621
$add_redirect_transient = is_null( $current_version ) ? true : false;

includes/class-wc-gzd-secret-box-helper.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ public static function get_encryption_key_data( $salt = '', $encryption_type = '
6363
$result['key'] = sodium_hex2bin( constant( self::get_encryption_key_constant( $encryption_type ) ) );
6464
} else {
6565
try {
66-
$pw = LOGGED_IN_KEY;
66+
if ( ! defined( 'LOGGED_IN_KEY' ) && ! defined( 'DB_PASSWORD' ) ) {
67+
$pw = 'insecure-default-pw';
68+
} else {
69+
$pw = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : DB_PASSWORD;
70+
}
71+
6772
$result['key'] = sodium_crypto_pwhash(
6873
SODIUM_CRYPTO_SECRETBOX_KEYBYTES,
6974
$pw,

includes/compatibility/class-wc-gzd-compatibility-woocommerce-product-bundles.php

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,7 @@ public function add_price_suffixes( $price, $org_price, $org_product ) {
255255
if ( $product = $org_product->get_product() ) {
256256
$add_suffixes = true;
257257

258-
if ( $product->is_type( 'variable' ) && self::$variable_has_filtered ) {
259-
$add_suffixes = false;
260-
} elseif ( strstr( $price, 'wc-gzd-legal-price-info' ) ) {
258+
if ( $product->is_type( 'variable' ) || strstr( $price, 'wc-gzd-legal-price-info' ) ) {
261259
$add_suffixes = false;
262260
}
263261

@@ -277,31 +275,23 @@ public function add_price_suffixes( $price, $org_price, $org_product ) {
277275
}
278276

279277
if ( $add_suffixes ) {
280-
ob_start();
281-
woocommerce_gzd_template_single_tax_info();
282-
$legal = ob_get_clean();
278+
$legal = '';
279+
$unit = '';
283280

284-
/**
285-
* Do not show the unit price for variable products which might contain (dynamically calculated) price ranges.
286-
*/
287-
if ( ! $product->is_type( 'variable' ) ) {
288-
ob_start();
289-
woocommerce_gzd_template_single_price_unit();
290-
$unit = ob_get_clean();
291-
} else {
292-
$unit = '';
293-
// Make sure the tax-info class is not being replaced by variation data.
294-
$legal = str_replace( 'tax-info', 'tax-info-static', $legal );
281+
if ( $tax_info = \Vendidero\Germanized\Shopmarks::get( 'single_product', 'legal' ) ) {
282+
if ( $tax_info->is_enabled() ) {
283+
$legal = $tax_info->get_html();
284+
}
295285
}
296286

297-
$price = $price . '<span class="wc-gzd-legal-price-info">' . $this->replace_p_tags( $unit ) . $this->replace_p_tags( $legal ) . '</span>';
287+
if ( $unit_price = \Vendidero\Germanized\Shopmarks::get( 'single_product', 'unit_price' ) ) {
288+
if ( $unit_price->is_enabled() ) {
289+
$unit = $unit_price->get_html();
290+
}
291+
}
298292

299-
/**
300-
* Do only add these suffixes to the variable parent product and not to every single variation which
301-
* retrieves shopmarks via JS.
302-
*/
303-
if ( $product->is_type( 'variable' ) ) {
304-
self::$variable_has_filtered = true;
293+
if ( ! empty( $legal ) || ! empty( $unit ) ) {
294+
$price = $price . '<span class="wc-gzd-legal-price-info">' . $this->replace_p_tags( $unit ) . $this->replace_p_tags( $legal ) . '</span>';
305295
}
306296
}
307297
}

src/Shopmark.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,22 @@ public function execute() {
224224
}
225225
}
226226

227+
public function get_html( $params = array() ) {
228+
if ( is_null( $this->get_callback() ) || ! $this->is_enabled() ) {
229+
return '';
230+
}
231+
232+
try {
233+
ob_start();
234+
call_user_func_array( $this->get_callback(), $params );
235+
$html = ob_get_clean();
236+
} catch ( \Exception $e ) {
237+
$html = '';
238+
}
239+
240+
return $html;
241+
}
242+
227243
public function remove() {
228244
if ( is_null( $this->get_callback() ) ) {
229245
return;

src/Shopmarks.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,9 @@ public static function register( $location = '' ) {
946946
}
947947

948948
/**
949-
* @return Shopmark[]
949+
* @return Shopmark[]|Shopmark|false
950950
*/
951-
public static function get( $location = '' ) {
951+
public static function get( $location = '', $type = '' ) {
952952
if ( ! empty( $location ) ) {
953953
$data = array();
954954

@@ -958,6 +958,19 @@ public static function get( $location = '' ) {
958958
}
959959

960960
$data = isset( self::$shopmarks[ $location ] ) ? self::$shopmarks[ $location ] : array();
961+
962+
if ( ! empty( $type ) ) {
963+
$result = false;
964+
965+
foreach ( $data as $shopmark ) {
966+
if ( $type === $shopmark->get_type() ) {
967+
$result = $shopmark;
968+
break;
969+
}
970+
}
971+
972+
return $result;
973+
}
961974
}
962975
} else {
963976
$data = self::$shopmarks;

0 commit comments

Comments
 (0)