在Woocommerce中将产品描述简短描述后移动

时间:2018-07-17 13:58:03

标签: php wordpress woocommerce product hook-woocommerce

我使用了此钩子的第一个选项(其他钩子不起作用)-> Woocommerce Product Default Description for All Products

And this is how it looks(红色标记的文本是标准描述)

但是,我希望文本显示在产品说明之后。 where the red arrow is, I want the standard text.在“在winkelmand中”(意思是“添加到购物袋”中)上方

我该如何实现?

2 个答案:

答案 0 :(得分:0)

这可以通过以下代码(注释)完成:

// 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>';
}

代码进入您的活动子主题(或活动主题)的function.php文件中。经过测试,可以正常工作。

答案 1 :(得分:0)

那个也不对我有用,所以我一直在寻找,发现那个非常好用

// 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 );
相关问题