Skip to content

Instantly share code, notes, and snippets.

@PluginRepublicSupport
Created January 31, 2023 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PluginRepublicSupport/91a4b195d9ade89a4f5275ce643ef252 to your computer and use it in GitHub Desktop.
Save PluginRepublicSupport/91a4b195d9ade89a4f5275ce643ef252 to your computer and use it in GitHub Desktop.
Custom Attributes WooCommerce Child Product
<?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