Skip to content

Instantly share code, notes, and snippets.

@Korveld
Last active September 16, 2021 10:12
Show Gist options
  • Select an option

  • Save Korveld/3f6932a321bbb6dda0005406bdda7787 to your computer and use it in GitHub Desktop.

Select an option

Save Korveld/3f6932a321bbb6dda0005406bdda7787 to your computer and use it in GitHub Desktop.
Woocommerce show brand names in product page
add_action( 'woocommerce_single_product_summary', 'artlife_add_brand_name_to_product_page', 19 );
function artlife_add_brand_name_to_product_page() {
global $post;
$brands = wp_get_post_terms( $post->ID, 'product_brand', array("fields" => "all") );
foreach( $brands as $brand ) {
echo __( 'Brand', 'pharmacy') . ': ' . $brand->name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment