Created
January 31, 2023 14:01
-
-
Save PluginRepublicSupport/91a4b195d9ade89a4f5275ce643ef252 to your computer and use it in GitHub Desktop.
Custom Attributes WooCommerce Child Product
This file contains 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 | |
/** | |
* Show custom attributes in child product | |
*/ | |
/** | |
*Snippet to add show ACF field content in child product | |
*/ | |
function acf_filter_field($title, $child_product) { | |
return sprintf('<h4>%s</h4><p>%s</p><p>Météo annuelle: %s</p><p>Domaine: %s</p><p>Région: %s</p>', | |
$title, | |
$child_product->get_attribute( 'millésime' ), | |
get_field('synthèse_degustation', $child_product->get_ID()), | |
$child_product->get_attribute( 'domaine' ), | |
$child_product->get_attribute( 'zone_géographique' ) | |
); | |
} | |
add_filter( 'pewc_child_product_title', 'acf_filter_field', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment