- Web Templates
- E-commerce Templates
- CMS und Blog Templates
- Facebook Templates
- Website-Builder
WooCommerce. Wie man die Preisspanne für variable Produkte entfernt
Juni 2, 2016
Dieses Video Tutorial wird Ihnen zeigen, wie man die Preisspanne für variable Produkte in WooCommerce Vorlagen ändert.

-
Verbinden Sie sich mit FTP/File Manager, öffnen Sie das: wp-content/themes/themeXXXXX/includes Verzeichnis und finden Sie die custom-function.php Datei zum Bearbeiten.
Sie können die Datei custom-function.php auch in Appearance > Editor in Ihrer WordPress Admin Panel finden.
Um den höheren Preis zu löschen, sollten Sie den folgenden Code zur custom-function.php Datei – vor dem schließenden ?> Tag am Ende hinzufügen:
/* Disable Variable Product Price Range: */ add_filter( 'woocommerce_variable_sale_price_html', 'my_variation_price_format', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'my_variation_price_format', 10, 2 ); function my_variation_price_format( $price, $product ) { // Main Price $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); $price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); // Sale Price $prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); sort( $prices ); $saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); if ( $price !== $saleprice ) { $price = '<del>' . $saleprice . '</del> <ins>' . $price . '</ins>'; } return $price; }
Hier ist das Ergebnis:
-
Um die Preisspanne komplett zu löschen, werden wir den folgenden Code in die custom-function.php Datei – vor dem schließenden ?> Tag am Ende hinzufügen:
/* Disable Variable Product Price Range completely: */ add_filter( 'woocommerce_variable_sale_price_html', 'my_remove_variation_price', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'my_remove_variation_price', 10, 2 ); function my_remove_variation_price( $price ) { $price = ''; return $price; }
Weiter unten sehen Sie, was es gebracht hat:
Sie können sich gerne unser detaliertes Video Tutorial anschauen
WooCommerce. Wie man die Preisspanne für variable Produkte entfernt