How to set woocommerce a custom meta field with an xml value

I have an xml and Ican set a whole column with some values. While my column is populated with xml values, my custom field inside product is not. I cannot figure out how to do it.

//FUNCTIONS TO DISPLAY PRICES
function read_parse_xml1($column, $product_sku, $xml)
{

global $xml;

foreach($xml as $x) {
$sku = $x->sku;
$bfsku = $x->bf_sku;
$suppliersku = $x->supplier_sku;
$price = $x->price;
$availability = $x->availability;
$costnovat = $x->cost_no_vat;
$minprice = $x->min_price;

if($sku==$product_sku)
{
echo ‘<div id=”_supprice-‘ . $post_id . ‘”>’ . number_format( (float)$price,2) . € . ‘</div>’;

}
}

}

How to take xml field $price for each product and save it to meta field _text_field?

Read more here:: How to set woocommerce a custom meta field with an xml value

Leave a Reply

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