Trong trường hợp website của bạn có hàng nghìn sản phẩm thì mỗi lần thay đổi giảm giá mất nhiều thời gian. Vì vậy sử dụng đoạn code sau sẽ giúp bạn khắc phục được vấn đề trên.
add_filter('woocommerce_get_sale_price', 'discount_price_pttuan', 99, 2);
add_filter('woocommerce_get_price', 'discount_price_pttuan', 99, 2);
function discount_price_pttuan( $price, $product )
{
if( $product->is_type( 'simple' ) ){
$price = $product->get_regular_price() * 0.5;
}
return $price;
}
Bạn chỉ cần copy đoạn code trên và vào Giao diện=> Sửa giao diện=> dán vào file functions.php.

Ví dụ, cụ thể trong đoạn code trên là giảm giá 50%. Còn bạn muốn giảm giá 40%,30%… bao nhiêu thì thay vào code nhe!
Kết quả chúng ta được

Chúc bạn thành công.
P/s: đoạn code này chỉ áp dụng cho sản phẩm giản đơn (không dùng đối với sản phẩm có biến thể)
Nguồn: pttuan410
Xem thêm:
- Die Evolution der Online Slots: Innovation, Verantwortung und das Spielerlebnis
- Innovazione nel Gaming Mobile: Analisi delle Tendenze e dei CasI di Successo
- The Evolution of Online Slot Gaming: Embracing Expert-Recommended Titles for Sustainability and Engagement
- Innovation et Économie des Jeux de Loterie :
- Revolutionizing the Digital Gaming Economy: The Rise of Secure Online Platforms