Thay đổi vị trí của giá bán và giá khuyến mãi trong WooCommerce của wordpress, thay đổi cho giá khuyến mãi đứng trước giá gốc :
Mã chèn vào funtions.php
add_filter( 'woocommerce_format_sale_price', 'invert_formatted_sale_price', 10, 3 );
function invert_formatted_sale_price( $price, $regular_price, $sale_price ) {
return '<ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins> <del>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del>';
}
The following hooked function code will display the Sale price before Regular price:
Display the Sale price before Regular price in WooCommerce
Bài viết liên quan :
3 Sản Phẩm Khởi Nghiệp Kinh Doanh Với 50 Triệu Đồng
Chia sẻ plugin Seo web số 1 Rank Math SEO Pro miễn phí – Cập nhật mới
Tạo nút nhắn tin Sms, Zalo, Facebook 2020
Hướng dẫn cài đặt tự động chuyển hướng trang web sau 1 thời gian xác định
Tạo bộ lọc sản phẩm theo kích thước, màu sắc, nhà sản xuất v.v.. của sản phẩm
Top 15 WordPress themes dành cho các công ty công nghệ