Cannot import xml file for a custom column with woocommerce

I am new with this but I have created an xml file and copied it to my domain. I use a function like the following to read my xml and nodes

function read_parse_xml()
{
$url = ‘https://example.com/ProductsUpdates4.xml’;
$xml = file_get_contents($url);
$xml = simplexml_load_string($xml);

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

}

}

I am trying to call my function from

add_action(‘manage_posts_custom_column’, ‘wnetpp_populate_custom_columns3’, 10, 2);
function wnetpp_populate_custom_columns3( $column, $post_id ) {

if ($column == ‘test_column3’) {

$current_product = wc_get_product( $post_id );
$product_sku = $current_product->get_sku();

read_parse_xml();

echo ‘<div id=”_supprice-‘ . $post_id . ‘”>’ . $price . ‘</div>’;

}

}

What I m doing wrong?

Read more here:: Cannot import xml file for a custom column with woocommerce

Leave a Reply

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