简体   繁体   中英

Move product description after short description in Woocommerce

I've used the first option of this hook (the other ones didn't work) -> Woocommerce Product Default Description for All Products

And this is how it looks (the red marked text is the standard description)

However, I want the text to appear after the product description. where the red arrow is, I want the standard text. So above 'in winkelmand' (which means 'add to bag')

How can I achieve this?

This can be done with the following code (commented) :

// 1. Remove the description product tab
add_filter( 'woocommerce_product_tabs', 'remove_descrip_product_tab', 98 );
function remove_descrip_product_tab( $tabs ) {
    // Remove the description tab
    unset( $tabs['description'] );

    return $tabs;
}

// 2. Add the product description after the product short description
add_action( 'woocommerce_single_product_summary', 'my_custom_action', 25 );
function my_custom_action() {
    global $post;

    // Product description output
    echo '<div class="product-post-content">' . the_content() . '</div>';
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

That one did not work for me either, so I kept looking and found this one, which worked perfectly

// Move Description to Under Price WooCommerce

    function woocommerce_template_product_description() {wc_get_template( 'single-product/tabs/description.php' );}

    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_product_description', 20 );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM