Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 430
Akhtarujjaman Shuvo Avatar asked Dec 07 '25 14:12

Akhtarujjaman Shuvo


1 Answers

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

like image 114
LoicTheAztec Avatar answered Dec 09 '25 16:12

LoicTheAztec



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!