Created
November 11, 2019 09:45
-
-
Save webdados/11b99b61dc50ff1259896a46b528cf13 to your computer and use it in GitHub Desktop.
Using woocommerce_display_product_attributes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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