I updated xstore to the latest version. My site was working ok, but ma DE (only de) version was crashed.
https://cleanshot.com/share/5jnNTzzp
Error:
Uncaught ArgumentCountError: 3 arguments are required, 2 given
in wp-content/themes/xstore/framework/woo.php:3172
Root cause:
In etheme_sale_label_percentage_text() (around line 3068–3172 in woo.php), the sale label is built using:
sprintf( str_replace(‘{sales_text}’, $element_options[‘sale_label_text’], __( ‘{sales_text} %s’, ‘xstore’ )), $percentage )
The issue is that __( ‘{sales_text} %s’, ‘xstore’ ) returns the translated string from the DE language file, which apparently contains two placeholders (e.g. %s %s or %1$s %2$s) instead of the original {sales_text} %s. This causes sprintf() to expect 3 arguments but only receive 2, resulting in a fatal error.
Workaround applied:
Replaced the sprintf() call entirely with a direct str_replace + string concatenation:
$element_options[‘sale_label_text’] = str_replace( ‘{sales_text}’, $element_options[‘sale_label_text’], ‘{sales_text} ‘ . round( ( ( $element_options[‘regular_price’] – $element_options[‘sale_price’] ) / $element_options[‘regular_price’] ) * 100 ) . ‘%’ );
how do I avoid this in the future updates?