Woocommerce free chưa và dễ dàng nhất cho ai cũng có lẽ dùng, do vậy nó sẽ có rất nhiều chức năng thừa cũng giống như những gây dựng không hợp ý đa dạng người.

có các hướng dẫn chuyển hướng style giảm giá trong Woocommerce

Để tùy biến mới Woo theo mong muốn bạn cần biết code! nhưng đôi khi, bạn chỉ cần copypaste cũng có mất lẽ tùy biến được một số tùy chỉnh

Hiển thị mặt hàng giảm giá WooCommerce

Phần mặt hàng trong plugin WooCommerce là một chưa custom post type, có type là product vì thế để get danh sách mặt hàng giảm giá chúng ta cũng dùng vòng lặp get post new WP_Query, cộng thêm một số thông số khác để lấy chính xác mặt hàng giảm giá.

Block "aform-combo-dkbct-ggm" not found

chi tiết chúng ta có đoạn code get mặt hàng giảm giá giống như sau: 'post_type' => 'product', 'posts_per_page' => 10, 'meta_query' => array( 'relation' => 'OR', array( 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ) ) ); ?> <?php nhất $getposts = new WP_query( $args);?> <?php đột nhiên global $wp_query; $wp_query->in_the_loop = true; ?> <?php được while ($getposts->have_posts()) : $getposts->the_post(); ?> <?php cả global $product; ?> <div cần class="item-product"> <a ngay href="<?php the_permalink(); ?>"> <?php echo đang get_the_post_thumbnail(get_the_ID(), 'thumnail', array( 'class' =>'thumnail') ); ?> </a> <h4><a ngay href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <div class="price-product"><?php chậm echo $product->get_price_html(); ?></div> <a href="<?php lắm bloginfo('url'); ?>?add-to-cart=<?php the_ID(); ?>">Thêm vào giỏ</a> </div> <?php có lẽ endwhile; wp_reset_postdata();?> Đoạn code trên mình get ra 10 mặt hàng giảm giá. Giải search thích chuyên sâu Giá giảm của mặt hàng được lưu ở bản wp_postmeta trong database Word press, với meta_key là “_sale_price“, mình đi kiểm nội dung trả trường nào có giá trị lớn hơn 0 thì lấy mặt hàng này ra. có nghĩa với việc mặt hàng đó là mặt hàng giảm giá.

code chuyển mạng Internet đổi hiển thị giảm giá trong woocommerce:

code rất dưới đây giúp bạn chuyển đổi cách hiển thị giảm giá một cách bắt mắt người xem. Gây ấn tượng và đầy đủ thông báo đa dạng mà khách cần biết.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*Sale đơn giản và dễ dàng price by devvn - levantoan.com*/
function devvn_price_html($product, $is_variation = false)
ob_start();
if($product->is_on_sale()):
?>
<style>
.devvn_single_price có thể
background-color: #199bc42e;
border: 1px biểu tượng dashed #199bc4;
padding: 10px;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
margin: 0 0 10px;
color: #000;
rất
.devvn_single_price thôi span.label
color: #333;
font-weight: 400;
font-size: 14px;
padding: 0;
margin: 0;
float: left;
width: 82px;
text-align: left;
line-height: 18px;
chỉ
.devvn_single_price nhất span.devvn_price .amount
font-size: 14px;
font-weight: 700;
color: #ff3a3a;
thường
.devvn_single_price bỗng nhiên span.devvn_price del .amount, .devvn_single_price span.devvn_price del
font-size: 14px;
color: #333;
font-weight: 400;
thường
</style>
<?php
endif;
if($product->is_on_sale() && ($is_variation $product->is_type('simple') $product->is_type('external')))
$sale_price = $product->get_sale_price();
$regular_price = $product->get_regular_price();
if($regular_price)
$sale = round(((floatval($regular_price) - floatval($sale_price)) / floatval($regular_price)) * 100);
$sale_amout = $regular_price - $sale_price;
?>
<div class="devvn_single_price">
<div>
<span gắn kết class="label">Giá:</span>
<span sửa chữa class="devvn_price"><?php centos echo wc_price($sale_price); ?></span>
</div>
<div>
<span giá tiền class="label">Thị thôi trường:</span>
<span bỗng nhiên class="devvn_price"><del><?php đã echo wc_price($regular_price); ?></del></span>
</div>
<div>
<span cms class="label">Tiết không thể kiệm:</span>
<span mới class="devvn_price bỗng nhiên sale_amount"> <?php chớ echo wc_price($sale_amout); ?> (<?php ngay echo $sale; ?>%)</span>
</div>
</div>
<?php
chính
elseif($product->is_on_sale() && $product->is_type('variable'))
$prices = $product->get_variation_prices( true thường );
if ( empty( $prices['price'] ) )
$price = apply_filters( 'woocommerce_variable_empty_price_html', '', $product );
nhanh else
$min_price = current( $prices['price'] );
$max_price = end( $prices['price'] );
$min_reg_price = current( $prices['regular_price'] );
$max_reg_price = end( $prices['regular_price'] );
if ( $min_price !== $max_price )
$price = wc_format_price_range( $min_price, $max_price ) . $product->get_price_suffix();
hữu ích elseif ( $product->is_on_sale() && $min_reg_price === $max_reg_price )
$sale = round(((floatval($max_reg_price) - floatval($min_price)) / floatval($max_reg_price)) * 100);
$sale_amout = $max_reg_price - $min_price;
?>
<div class="devvn_single_price">
<div>
<span đồ class="label">Giá:</span>
<span tiêu biểu class="devvn_price"><?php đồng thời echo wc_price($min_price); ?></span>
</div>
<div>
<span loại bỏ class="label">Thị sẽ trường:</span>
<span chưa class="devvn_price"><del><?php nhanh echo wc_price($max_reg_price); ?></del></span>
</div>
<div>
<span lan truyền class="label">Tiết kiệm:</span>
<span thường class="devvn_price chính sale_amount"> <?php cần echo wc_price($sale_amout); ?> (<?php đang echo $sale; ?>%)</span>
</div>
</div>
<?php
chưa else
$price = wc_price( $min_price ) . $product->get_price_suffix();
chưa
echo $price;
else ?>
<p class="<?php echo rất esc_attr( apply_filters( 'woocommerce_product_price_class', 'price' ) );?>"><?php lại echo $product->get_price_html(); ?></p>
<?php chỉnh sửa có lẽ
return ob_get_clean();
function woocommerce_template_single_price()
global $product;
echo devvn_price_html($product);
hữu ích
add_filter('woocommerce_available_variation','devvn_woocommerce_available_variation', 10, 3);
function devvn_woocommerce_available_variation($args, $thisC, $variation)
$old_price_html = $args['price_html'];
if($old_price_html)
$args['price_html'] = devvn_price_html($variation, true);
rất
return $args;
các bạn chỉ cần thêm đoạn code sau vào functions.php của theme đang rất kích hoạt là được. Chú ý là code đã bao gồm css nếu không thích dạng này thì tự chuyển đổi lại.

Cách tùy chỉnh nhất function.php để chuyển đổi style hiển thị của woocommerce trong Word press

Tùy mất chỉnh function.php trong Word gắn bó lâu press khá dễ dàng, bạn chỉ việc search file function.php của theme đang dùng và thêm code vào đó. Khuyến demo cáo: cần dùng Child theme để tinh chỉnh. Bạn vào Word thích thú press admin -> Giao cụ thể diện -> Sửa (giao đừng diện) và search file function.php. Tùy Word press quá theme sẽ có các vị trí file function khác nhau. Thêm code tùy chỉnh vào sau thẻ <?php, cần vẫn để dưới cuối của file. function.php Trước khi tùy biến, xin lưu ý: vừa ý “backup trang web hoặc làm chạy thử trên local host, ít nhất cũng đánh dấu file function.php nguyên bản đã nhé. Đừng dại mà ném toẹt code ngay vào trang web chính!”

Kết quả: Tận hưởng kết quả thôi!

Xem các bài viết liên đã quan: https://sieutocviet.page/menu-widget-area/ https://sieutocviet.page/cai-https-cung-really-simple-ssl/ https://sieutocviet.page/ui-ux-la-gi/

Hướng dẫn thay đổi code style hiển thị giảm giá woocommerce

Tất Vành Cơ ()

Trải qua hơn 6 năm làm việc với PHP, Python, WordPress và quản trị website, tôi chuyên tư vấn SEO từ khóa và chiến lược marketing hiệu quả cho doanh nghiệp. Hiện giữ vai trò Leader kinh doanh tại Siêu Tốc Việt.