• Resolved ricardogrune

    (@ricardogrune)


    Hi,

    We are using Atum for our SKU and EAN and we use Woocommerce Product Feed Manager (https://www.wpmarketingrobot.com/) to create feeds for google ads.

    We have to select the Source of the value of the EAN and SKU. But i can’t see how atum sets these values.

    Could you tell me which meta’s i can use to put the values in my feed?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jose Andres Piera

    (@japiera)

    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

    Thread Starter ricardogrune

    (@ricardogrune)

    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’);

    Plugin Author Jose Andres Piera

    (@japiera)

    Hi @ricardogrune,

    I see. It’s a good option in your case.

    Please note that you’ll need to keep values synchronised. Remember that you should never change the meta field values unless you also update the ATUM fields.

    Best Regards,
    José Andrés

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ATUM in Woocommerce Product Feed Manager’ is closed to new replies.