Update variation product price – not visible in product page – Woocommerce

i have made custom import products which are variable type. Then i have make a file that has to update the variation product price. I am using the update_post_meta method. The values are appearing in the edit product page in the field of each variation, but it’s not seems to update the price in the front page of the product.

I have to make a update product (by clicking the update button) in admin panel to work with the new prices.

I have tried using $product->variable_product_sync(); but it didn’t seemed to work. Any ideas?

Sample of my code:

foreach ($variations as $variationProduct) { 
   $variationProductId =  $variationProduct["variation_id"];
   $productPrice = number_format($productPrice, 2, '.', '');
   update_post_meta( $variationProductId, '_regular_price', $productPrice);
}

Any help or solution on this?

Read more here: Update variation product price – not visible in product page – Woocommerce

Leave a Reply

Your email address will not be published. Required fields are marked *