Home Forums WoodMart support forum Short Product Description

Short Product Description

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #656021

    Roi667
    Participant

    Hey, I am editing a single product layout page and I want the short product description to appear in a closed tab same as product description.
    How to make it appear in a closed tab?

    Attachments:
    You must be logged in to view attached files.
    #656076

    Hello,

    There is no option available for this in the theme settings. This requires customization, which is beyond our support policy.

    I have searched for a possible solution and found a custom function that you can add to your functions.php file. I have tested this code on our test site, and it is working fine.

    If the provided code does not work as expected, unfortunately, we are unable to modify it further.

    Add this to your theme’s functions.php file of the theme.

    // Remove short description
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
    
    // Add short description to a custom product tab
    add_filter( 'woocommerce_product_tabs', 'add_custom_product_tab', 10, 1 );
    function add_custom_product_tab( $tabs ) {
    
        $custom_tab = array(
            'custom_tab' =>  array(
                'title' => __( "Short description", "woocommerce" ),
                'priority' => 12,
                'callback' => 'short_description_tab_content'
            )
        );
        return array_merge( $custom_tab, $tabs );
    }
    
    // Custom product tab content
    function short_description_tab_content() {
        global $post, $product;
    
        $short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );
    
        if ( ! $short_description ) {
            return;
        }
    
        echo '<div class="woocommerce-product-details__short-description">' . $short_description . '</div>'; 
    }

    Hope this Helps!

    Best Regards,

    #656352

    Roi667
    Participant

    It worked perfectly! Thank you.

    #656389

    Hello,

    You’re very welcome! I’m glad I could help. If you need anything else, feel free to reach out!

    Thanks for contacting us.
    Have a great day.

    Best Regards

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Short Product Description’ is closed to new replies.