Thông thường, Woocommerce hiển thị giá thường trước giá sale. Nếu bạn muốn hoán đổi lại, hiển thị giá sale trước giá thường Regular thì dùng đoạn code dưới đây:
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>'; }