簡體   English   中英

在Woocommerce中將產品描述簡短描述后移動

[英]Move product description after short description in Woocommerce

我已經使用了此鈎子的第一個選項(其他鈎子不起作用)-> 所有產品的Woocommerce產品默認說明

這就是它的外觀 (紅色標記的文本是標准描述)

但是,我希望文本顯示在產品說明之后。 紅色箭頭在哪里,我想要標准文本。 因此,在“在winkelmand中”(即“添加到購物袋”中)上方

我該如何實現?

可以使用以下代碼(已注釋)完成此操作:

// 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文件中。 經過測試和工作。

那一個也不適合我,所以我一直在尋找,發現這個非常好用

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM