在WordPress和woocommerce实际开发过程中,我们需要对产品页面进行自定义布局,可能会涉及到移除woocommerce产品页面的评论reviews、附加信息additional_information和描述description模块,

代码如下:

//去除现有产品页面的评论、描述、附加信息模块
function woo_remove_product_module( $tabs ){
    unset( $tabs['reviews'] );
    unset( $tabs['description'] );
    unset( $tabs['additional_information'] );
    return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_module' );

将上述代码添加到主题模板文件的functions.php文件即可。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。