• Hi
    There is provided git code to match with woocommerce which work perfectly
    Now how to add subtitle while using Product Bundle extension for woo?
    This extension summaries more than one simple product together.
    I need to show subtitle in bundle items too.
    And thanks for this great plugin ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    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

    Thread Starter saeedhzm

    (@saeedhzm)

    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

    Plugin Author HelgaTheViking

    (@helgatheviking)

    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 );

    `

    Thread Starter saeedhzm

    (@saeedhzm)

    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.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    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?

    Thread Starter saeedhzm

    (@saeedhzm)

    why not and it is done ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Woocommerce product bundle’ is closed to new replies.