Reputation: 23
I am trying to place an image next to the product description in the tabs of woocommerce. The code I am trying to use is this:
add_action('woocommerce_template_product_description', 'badge', 25);
function badge() {
echo '<div class="badge"><img src="URL" style="width:175px;height:175px;"></div>';
}
I have not had any luck in getting it to display, and am thinking that the 'woocommerce_template_product_description' maybe the problem - I'm sure if I am targeting the product description correctly. I think tabs are increasing the complexity of the solution.
Using the code below the image displays next to the product summary.
add_action('woocommerce_single_product_summary', 'badge', 25);
function badge() {
echo '<div class="badge"><img src="URL" style="width:175px;height:175px;"></div>';
}
I would appreciate some help is solving this problem.
Upvotes: 0
Views: 2533
Reputation: 23
After much head scratching I think I might have figured it out. This code seems to work:
add_filter( 'woocommerce_product_tabs', 'magva_badge', 98 );
function magva_badge( $tabs ) {
$tabs['description']['callback'] = 'woo_custom_description_tab_content'; // Custom description callback
return $tabs;
}
function woo_custom_description_tab_content() {
woocommerce_product_description_tab(); echo '<div class="magva_badge"><img src="https://www.magva.com/wp-content/uploads/2015/10/made_in_ireland.png" style="width:175px;height:175px;"></div>';
}
Upvotes: 1