Move product description after short description in Woocommerce

Deadly 提交于 2021-01-27 20:20:18

问题


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?


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/51383315/move-product-description-after-short-description-in-woocommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!