Insert products to woocommerce does not show the price

0

Good community, I'm having a problem and I do not know how to fix it. I am entering the data via PHP and I have the problem that the price does not show in the capture you have here: Capture_1) Capture_2)

On the other hand, you enter the product card and if the prices entered correctly are shown. When I simply update the product, it automatically fills in the Price field that was not previously shown. Do you know why this happens?

$post = array(
        'post_title'        =>  $qwe,
        'post_content'      =>  $content
}
update_post_meta($new_post_id, '_regular_price', $precioAnterior); 
update_post_meta($new_post_id, '_sale_price', $precio); 
    
asked by Fumatamax 06.02.2018 в 15:57
source

1 answer

0

This problem has been solved by simply adding the following line of code, which serves to give you the base price.

update_post_meta( $new_post_id, '_price', $precioAnterior);
    
answered by 06.02.2018 / 16:49
source