WooCommerce - Move Product Description out Tabs into Summary

后端 未结 2 1026
时光取名叫无心
时光取名叫无心 2021-01-31 12:01

I\'ve hunted high and low how to move the Product Description on a Single Product page of Woocommerce out of the tabs and in to the main section. I just can\'t find it anywhere!

相关标签:
2条回答
  • 2021-01-31 12:26

    This worked great, thanks for the solution to my problem!

    To get rid of the tabs, use this code -

    add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
    
    function woo_remove_product_tabs( $tabs ) {
    
      unset( $tabs['description'] );        // Remove the description tab
      unset( $tabs['reviews'] );            // Remove the reviews tab
      // unset( $tabs['additional_information'] );      // Remove the additional information tab
    
      return $tabs;
    
    }
    
    0 讨论(0)
  • 2021-01-31 12:36

    Just after submitting this I had an idea, all of the hooks are just functions so I created a new function and included the product description code:

    function woocommerce_template_product_description() {
    woocommerce_get_template( 'single-product/tabs/description.php' );
    }
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_product_description', 20 );
    

    Edit: since latest versions of woocommerce this code should still work like so

    function woocommerce_template_product_description() {
    wc_get_template( 'single-product/tabs/description.php' );
    }
    add_action( 'woocommerce_single_product_summary', 'woocommerce_template_product_description', 20 );`
    
    0 讨论(0)
提交回复
热议问题