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:
- Le rôle stratégique des critiques et analyses dans l’évaluation des jeux vidéo familiaux
- Innovationen in der Hundetraining-Branche: Nachhaltigkeit, Ethik und Qualität
- Innovation och tillgänglighet inom digitala lösningar: Fallstudier och framtidsspaningar
- La Evolución de la Confianza en los Casinos en Línea: ¿Cómo Identificar un Sitio Fiable?
- Reimagining Prize Locking Mechanics in Modern Online Slots: Insights and Industry Trends