ATUM in Woocommerce Product Feed Manager

Hi @ricardogrune,

Thanks for your post and for using ATUM.

The plugin stores all the ATUM fields in custom tables for performance reasons. That implies you can’t access the EAN field by accessing the products’ post meta fields.

To access ATUM properties, you’d need some custom code like:
$product = \Atum\Inc\Helpers::get_atum_product( $product_id );
$ean = $product->get_barcode();
$purchase_price = $product->get_purchase_price(); ...

SKU is a WooCommerce’s field and you can access it by default.

Hope this helps,

Best Regards,
José Andrés

Hi Jose,

I already fixed it with this:

function update_product_meta_data() {
global $wpdb;

// Selecteer alle producten met een barcode en supplier_sku
$query = "SELECT product_id, barcode, supplier_sku FROM wp_atum_product_data WHERE barcode IS NOT NULL OR supplier_sku IS NOT NULL";
$products_with_meta = $wpdb->get_results($query);

foreach ($products_with_meta as $product) {
    // Update of voeg barcode meta toe
    if (!empty($product->barcode)) {
        $current_barcode = get_post_meta($product->product_id, 'barcode', true);
        if ($current_barcode !== $product->barcode) {
            update_post_meta($product->product_id, 'barcode', $product->barcode);
        }
    }

    // Update of voeg supplier_sku meta toe
    if (!empty($product->supplier_sku)) {
        $current_sku = get_post_meta($product->product_id, 'supplier_sku', true);
        if ($current_sku !== $product->supplier_sku) {
            update_post_meta($product->product_id, 'supplier_sku', $product->supplier_sku);
        }
    }
}

}

add_action(‘woocommerce_update_product’, ‘update_product_meta_data’);

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer