November 24, 2017 at 3:17 am
So we updated the theme (using the automatic function):
*Login to see link
1) The sales badges stoped showing percentages and now just say: “sale”.
I have placed the following code in the childtheme, but somehow it’s not working
Here is how it looked before:
*Login to see link
Here is how it looks now:
*Login to see link
add_filter( 'woocommerce_sale_flash', 'kt_custom_sales_flash', 10, 2 );
function kt_custom_sales_flash() {
global $product;
if ($product->is_on_sale() && $product->product_type == 'variable') {
$available_variations = $product->get_available_variations();
$percentage = 0;
for ($i = 0; $i < count($available_variations); ++$i) {
$variation_id=$available_variations[$i]['variation_id'];
$variable_product1= new WC_Product_Variation( $variation_id );
$regular_price = $variable_product1 ->regular_price;
$sales_price = $variable_product1 ->sale_price;
$percentage_base = round( ( ( $regular_price - $sales_price ) / $regular_price ) * 100 ) ;
if ($percentage_base > $percentage) {
$percentage = $percentage_base;
}
}
} else {
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
}
return '<span class="onsale bg_primary headerfont">'. sprintf( __(' Save %s', 'virtue' ), $percentage . '%' ).'</span>';
}
2) as you can also see on the above, the “read more” links are not alligned properly inside the product box anymore.
3) The entire product layouts is messed up.
Example.
*Login to see link
Before:
Now:
*Login to see link
4) As I mentioned in the last post, 2 theme widgets in the theme builder are now missing that we where using
I hope you can help us fast, it’s back friday here, so this update is expensive for us.