'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.
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.
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | LoicTheAztec |