Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bluantinoo

    (@bluantinoo)

    Solved,
    as I wanted to add a WYSIWYG custom field and I did not find a way to edit the Additional Information tab via hooks, neither to add it as custom field for product variations (as explained in this nice tut https://www.remicorson.com/woocommerce-custom-fields-for-variations/)

    I just copied template product-attrubutes.php file from woocommerce to my theme and I’ve added the custom field at the end of the file.

    Anyway, I would prefer doing it with an hook or a filter, without editing templates file, so I don’t have to worry about my theme files to be updated.
    So if you have any hint on how achive this, I’m glad to read it.

    datafeedr

    (@datafeedrcom)

    To avoid modifying and adding template files in the future, here’s how to hook into the attributes listed under the Additional Information tab and add a new row to the table in that section. This example code adds a new row to the table for an ISBN label and number:

    add_filter( 'woocommerce_get_product_attributes', 'mycode_display_extra_attribute', 20 );
    function mycode_display_extra_attribute( $attributes ) {
    
    	$attribute = array(
    		'name'         => 'ISBN',
    		'value'        => '9780811222631',
    		'is_visible'   => '1',
    		'is_taxonomy'  => '0',
    		'is_variation' => '0',
    		'position'     => '10',
    	);
    
    	$attributes['my_isbn'] = $attribute;
    
    	return $attributes;
    }

    Hope that helps!

    Eric

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding custom content to Product Additional Information tab’ is closed to new replies.