2016-05-26 7 views
3

バリエーションのために実際の価格でセール価格を移動したいと思っていますが、製品の要約部分ではこれを行いますが、バリエーションに対してはフィルタを見つけることができません。Woo-commerceバリエーションセール価格を実際の価格より下に移動

下記の画像をご覧ください。

enter image description here

私は私のコードは、夏らしい部分

add_filter('woocommerce_variable_sale_price_html', 'product_variation_price_format', 10, 2); 
add_filter('woocommerce_variable_price_html', 'product_variation_price_format', 10, 2); 

function product_variation_price_format($price, $product) { 
if(is_singular('product')){ 
// Main Price 
$prices = array($product->get_variation_price('min', true), $product->get_variation_price('max', true)); 
$price = $prices[0] !== $prices[1] ? sprintf(__('From: %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(__('From: %1$s', 'woocommerce'), wc_price($prices[0])) : wc_price($prices[0]); 

if ($price !== $saleprice) { 
$price = '<ins>' . $price . '</ins> <del>' . $saleprice . '</del>'; 
} 
    } 
return $price; 
} 

のために働いているこの問題を解決する方法を私を導いてください、このコードを試みたが、働いていません。

答えて

3

これは、CSSの問題の詳細です、あなたはあなたの構造に従って

.priceMainWrapperDiv { 
 
    display: table; 
 
} 
 
.salePriceDiv { 
 
    display: table-footer-group; 
 
} 
 
.actualPriceDiv { 
 
    display: table-header-group; 
 
}

+0

を使用してこのシンプルなスタイルタグ

変更のdivクラスのスタイルを設定することができますおかげで、それは働いていました –