Skip to content
Advertisement

Add rows to Single product Additional information table in WooCommerce 3.6

I am trying to add a row to Single product Additional information table.

Screenshot

Actually is there any hooks or filter to do this? I have searched the hook but can’t figure out the solution.

Any help is appreciated.

Advertisement

Answer

Since WooCommerce version 3.6, you can use woocommerce_display_product_attributes filter hook in this simple way, to add custom label/value pairs in “Additional Information” table (tab):

add_filter( 'woocommerce_display_product_attributes', 'custom_product_additional_information', 10, 2 );
function custom_product_additional_information( $product_attributes, $product ) {
    // First row
    $product_attributes[ 'attribute_' . 'custom-one' ] = array(
        'label' => __('Label One'),
        'value' => __('Value 1'),
    );

    // Second row
    $product_attributes[ 'attribute_' . 'custom-two' ] = array(
        'label' => __('Label Two'),
        'value' => __('Value 2'),
    );

    return $product_attributes;
}

Code goes in functions.php file of your active child theme (or active theme). Tested and work.

enter image description here

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement