• Resolved spiros13

    (@spiros13)


    Hello and congratulations on the very nice plugin. I would like to know if I can add an extra field to the table. My variation has an extra field from the ‘ACF Custom Fields’. And I would like it to appear in front of the table.

    I have made the following changes to content-tbody.php file

    add the field to $options:

    $options['maza'] = $single_variation->get_meta('maza');

    add the case for this field:

    case 'maza':
    
    $key1_title = __('Maza', 'product-variant-table-for-woocommerce');
    
    $key1 = apply_filters( 'pvtfw_maza_title', $key1_title );
    
    break; 

    and also change the class_pvtfw_common.php file

    add

    'maza' => "on", to get_default_columns() function.

    and add

    'maza' => __('Maza', 'product-variant-table-for-woocommerce')

    to get_columns_labels() function.

    But the field doesn’t display in table.

    Have I made a mistake? Do I need to add the field elsewhere?

    Thank you.

    • This topic was modified 3 years ago by spiros13.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Hakik Zaman

    (@hakik)

    Hi,

    Thanks for reaching out to me.

    Can you please share the field type? Or, a screenshot of the field you created for product edit page.

    content-tbody.php is the complex file of this plugin. So, if you show me how the field appears on product edit page; it will help me to regenerate like yours.

    Thanks

    Thread Starter spiros13

    (@spiros13)

    Thank you for quick response.
    The field type is text-field.

    see
    https://i.imgur.com/TotyRv9.png

    I want to display all these fields.I just hoped that if I could do it for one of them, I would be able to do it for the others to.

    • This reply was modified 3 years ago by spiros13.
    • This reply was modified 3 years ago by spiros13.
    Plugin Author Hakik Zaman

    (@hakik)

    Hi,

    $options['maza'] = $single_variation->get_meta('maza');

    should be-

    $options['maza'][] = $single_variation->get_meta('maza');

    Your coding procedure is ok. Just do one thing, Go to your site database and inside wp_options table you will get pvtfw_variant_table_columns just delete this data.

    Please also make sure you are getting data using $single_variation->get_meta('maza');

    For a test you can set a static value. For example-
    $options['maza'][] = 'My Data';

    I hope above explanation will help you to achieve what you wanted.

    Let me know after doing above. ??

    Thanks

    Thread Starter spiros13

    (@spiros13)

    Everything works fine after delete pvtfw_variant_table_columns inside wp_options

    Thanks

    Plugin Author Hakik Zaman

    (@hakik)

    Hi,

    Glad to know everything is working from your side.

    If you found my support helpful, my humble request to you to write your beautiful thought here.

    Indeed it will inspire me a lot. ??

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add extra custom field to table’ is closed to new replies.