mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://www.businessbloomer.com/woocommerce-move-sale-badge-beside-price-single-product-page/
10 lines
437 B
Text
10 lines
437 B
Text
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 );
|
|
|
|
add_filter( 'woocommerce_get_price_suffix', 'wc_add_price_suffix_sale', 9999, 4 );
|
|
|
|
function wc_add_price_suffix_sale( $html, $product, $price, $qty ) {
|
|
if ( ! is_admin() && is_object( $product ) && $product->is_on_sale() ) {
|
|
$html .= wc_get_template_html( 'single-product/sale-flash.php' );
|
|
}
|
|
return $html;
|
|
}
|