WooCommerce Grundpreis „ab“ statt von bis
-
Hallo zusammen,
Ich habe ein Produkt mit Varianten erstellt und die Preisdarstellung mit dem hier veröffentlichtem Code angepasst.
https://digital-workshop.at/woocommerce-preis-ab/
add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 ); function wc_wc20_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( __( ' ab %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( __( ' ab %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); if ( $price !== $saleprice ) { $price = '<del>' . $saleprice . '</del> <ins>' . $price . '</ins>'; } return $price; }
Es wird nun nicht mehr die Preisspanne von 50€ bis 100€ angezeigt, sondern ab 50€.
Leider wird hier der Grundpreis nicht berücksichtigt. Der Grundpreis wird also weiterhin mit 10€ – 20€ dargestellt. Habt ihr eine Idee, wie ich den Grundpreis ebenfalls anpassen kann?
- Das Thema „WooCommerce Grundpreis „ab“ statt von bis“ ist für neue Antworten geschlossen.