<?php
function avada_child_scripts() {
if ( ! is_admin() && ! in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) ) ) {
$theme_info = wp_get_theme();
wp_enqueue_style( 'avada-child-stylesheet', get_template_directory_uri() . '/style.css', array(), $theme_info->get( 'Version' ) );
}
}
add_action('wp_enqueue_scripts', 'avada_child_scripts');
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;
}
Das was fett markiert wurde, habe ich nachträglich eingefügt um bei variablen Preisen ein "ab" statt "von-bis" darzustellen
Wo muss ich also nun genau den Code einfügen damit die ähnlichen Produkte verschwinden?
Oder habe ich die functions.php gar schon mit meinem Codeschnipsel zerstört?
Ist da irgendwas unsauber eingefügt? Kenn mich leider nicht sehr git mit php/css aus. Habe bisher immer nur alles per Anleitung zusammen gepaspelt.
Beste Grüße