php - Update variation product price - not visible in product page - Woocommerce -
i have made custom import products variable type. have make file has update variation product price. using update_post_meta method. values appearing in edit product page in field of each variation, it's not seems update price in front page of product.
i have make update product (by clicking update button) in admin panel work new prices.
i have tried using $product->variable_product_sync(); didn't seemed work. ideas?
sample of code:
foreach ($variations $variationproduct) { $variationproductid = $variationproduct["variation_id"]; $productprice = number_format($productprice, 2, '.', ''); update_post_meta( $variationproductid, '_regular_price', $productprice); }
any or solution on this?
solved!! found through woocommerce api. if using woocommerce 2.7 or newer can use following line:
$product->save();
Comments
Post a Comment