You can try this snippet in your child theme’s functions.php or via the Code Snippets plugin:
/*
* Bundled Item Subtitles
*
* @param WC_Bundled_Item
*/
function kia_add_subtitle_to_cart_product( $bundled_item ) {
if ( function_exists( ‘get_the_subtitle’ ) ) {
$subtitle = get_the_subtitle( $bundled_item->get_product_id() );
if ( $subtitle ) {
$title .= ‘<h4 class=”subtitle”>’ . $subtitle . ‘</h4>’;
}
}
return $title;
}
add_filter( ‘woocommerce_bundled_item_details’, ‘kia_add_subtitle_to_cart_product’, 16 );`
`
It’s entirely untested, so please test in staging.
If it works please consider a contribution to the pizza fund:
https://www.paypal.com/paypalme/kathyisawesome
Hello
thanks for your time & reply
i changed the function name due to duplicate name :
/*
* Bundled Item Subtitles
*
* @param WC_Bundled_Item
*/
function kia_add_subtitle_to_bundle_product( $bundled_item ) {
if ( function_exists( ‘get_the_subtitle’ ) ) {
$subtitle = get_the_subtitle( $bundled_item->get_product_id() );
if ( $subtitle ) {
$title .= ‘<h4 class=”subtitle”>’ . $subtitle . ‘</h4>’;
}
}
return $title;
}
add_filter( ‘woocommerce_bundled_item_details’, ‘kia_add_subtitle_to_bundle_product’, 16 );
but there is something wrong because nothing happened .
the ‘Bundle Product’ subtitle is shown but ‘Bundled Items’ under that can’t have subtitle.
this link may help
Entirely untested means full of copy/paste fails. Biggest issue was $subtitle and $title not being consistent. But also the value needs to be echoed out on the action hook… it’s not a filter.
/**
* Bundled Item Subtitles
*
* @param WC_Bundled_Item
*/
function kia_add_subtitle_to_bundle_product( $bundled_item ) {
if ( function_exists( 'get_the_subtitle' ) ) {
$subtitle = get_the_subtitle( $bundled_item->get_product_id() );
if ( $subtitle ) {
echo '<h5 class="subtitle">' . $subtitle . '</h5>';
}
}
}
add_action( 'woocommerce_bundled_item_details', 'kia_add_subtitle_to_bundle_product', 16 );
`
Great
works like a charm !
thanks for help
here in Iran we are unable to purchase/donate since we are banned for paypal,visa,master and all other international card/payment but i can be grateful if you have a Rial option available for the Kia-Subtitle and or support in iran.
I didn’t know it was so difficult to send money… there goes my pizza fund. I appreciate the thought though. Instead, could you be sure to leave a good review for the plugin?