I have working WC shop. When I try to change the price to sale, I am using this code:
$prid = wc_get_product_id_by_sku('123456');
update_post_meta($prid,'_sale_price', 11.22);
update_post_meta($prid,'_price', 11.22);
This is a variable product.
So on the admin panel, it is showing that there is a sale price, but in the front-end I don't see it until I update the product by clicking the save button.
Why doesn't it show the sale price in the front-end before the save button is clicked?