Skip to content

Instantly share code, notes, and snippets.

@webdados
Created November 11, 2019 09:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdados/11b99b61dc50ff1259896a46b528cf13 to your computer and use it in GitHub Desktop.
Save webdados/11b99b61dc50ff1259896a46b528cf13 to your computer and use it in GitHub Desktop.
Using woocommerce_display_product_attributes
<?php
add_filter( 'woocommerce_display_product_attributes', 'extra_product_information', 10, 2 );
function extra_product_information( $product_attributes, $product ) {
$the_value = $product->get_meta( '_any_custom_field' );
if ( trim( $the_value ) != '' ) {
$product_attributes['any_custom_field'] = array(
'label' => 'Your label',
'value' => $the_value
);
}
return $product_attributes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment