How to change get_price_html in woocommerce

How to change get_price_html in woocommerce

First you put this code in your functions.php file.

//custom get price html
add_filter( 'woocommerce_get_price_html', 'custom_price_html', 100, 2 );
function custom_price_html( $price, $product ){
    return str_replace( '</del>', '<span class="del-img"></span></del>', $price );
}

After change style in your style.css file.

span.del-img {
    position: absolute;
    top: 10px;
    left: 0px;
    background: url('img/del-img.png') 50% 50% no-repeat;
    background-size: 100% 100%;
    z-index: 20;
    width: 100px;
    height: 25px;
}

del {
    text-decoration: none;
}

This is all.

I use this in one of my project: beatsbydre

 

 

 

Leave a Reply