Reputation: 331
I do have that code:
add_action('woocommerce_before_single_product', 'wtom_show_attributes_title', 15);
function wtom_show_attributes_title() {
global $product;
$abv = $product->get_attribute ('pa_weingut');
$abb = $product->get_attribute ('pa_weinart');
echo __($abv, $abb, 'woocommerce');
}
It returns only the first attribute pa_weingut
, how can I make an output to show both attributes? And how do I add a css class to the output?
Upvotes: 0
Views: 333
Reputation: 475
the __() function only takes to input arguments, but you're giving it 3. Why don't you call it twice?
add_action('woocommerce_before_single_product', 'wtom_show_attributes_title', 15);
function wtom_show_attributes_title()
{
global $product;
$abv = $product->get_attribute ('pa_weingut');
$abb = $product->get_attribute ('pa_weinart');
echo "<div class='someclassname'>" . __($abv,'woocommerce') . "</div>";
echo "<div class='someclassname'>" . __($abb,'woocommerce') . "</div>";
}
Upvotes: 1