• Hi, so I have tried desperately to create a custom meta field to get exported with this plugin but without any luck. I have created a custom field in the product general section, where I can input an image file name. The snippet code is below

    // Display Fields
    add_action('woocommerce_product_options_general_product_data', 'woocommerce_product_custom_fields');
    // Save Fields
    add_action('woocommerce_process_product_meta', 'woocommerce_product_custom_fields_save');
    function woocommerce_product_custom_fields()
    {
        global $woocommerce, $post;
        echo '<div class="product_custom_field">';
        // Field function
        woocommerce_wp_text_input(
            array(
                'id' => '_custom_image_name',
                'placeholder' => 'Image file name (ex. name.png)',
                'label' => __('Image file', 'woocommerce'),
                'desc_tip' => 'true'
            )
        );
        echo '</div>';
    }
    
    function woocommerce_product_custom_fields_save($post_id)
    {
        // Save function
        $woocommerce_custom_image_name = $_POST['_custom_image_name'];
        if (!empty($woocommerce_custom_image_name))
            update_post_meta($post_id, '_custom_image_name', esc_attr($woocommerce_custom_image_name));
    }

    As the code above provides a meta key with name _custom_image_name, once I populate it in product page, I add the meta field and do a test order. In the plugin, I add the meta key and do a test export and the result provides the meta key column empty. Could anyone please help with this? I tried getting it to work in the last 3 weeks without any luck.

    • This topic was modified 5 years, 4 months ago by showtek.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hi

    Have you tried >Setup Fields>Products>Add Field and 1st dropdown?
    I did it and I see image filename in the export.
    my screenshot https://imgur.com/V2I0nCs

    no need to lose 3 weeks ??
    thanks, Alex

    • This reply was modified 5 years, 4 months ago by algol.plus.
    Thread Starter showtek

    (@showtek)

    Hey,

    Thank you for your answer! I have tried to look it up in the directory you posted but seems that it does not show up there. I have tried to add the code via snippet plugin, activated and seems to not show up. I repeated by adding the code via theme functions.php without any luck as well. Could you please tell me where did you add the code to make it work?
    Thank you!

    Plugin Author algol.plus

    (@algolplus)

    Hi

    You must click button “Add field” at tab “Products”!

    and you don’t need any code.

    thanks, Alex

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom meta key not working’ is closed to new replies.