Woocommerce:删除“附加信息"标签 [英] Woocommerce: delete "additional information" tab

查看:200
本文介绍了Woocommerce:删除“附加信息"标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在此网站的产品页面上做两件事: https://lovesometea .com/product/green-coconut/

Two things I am trying to do on the product pages of this website: https://lovesometea.com/product/green-coconut/

1)删除其他信息"标签 2)在产品说明上方添加属性大小"

1) Delete "additional information" tab 2) Add Attribute "Size" above the product description

要删除其他信息"标签,我一直在关注: https://idevie.com/tutorials/how-to-make-woocommerce-product-attributes-more-prominent

To delete the "additional information" tab, I have been following this: https://idevie.com/tutorials/how-to-make-woocommerce-product-attributes-more-prominent

这就是我所做的: 1)添加了一个自定义插件并激活了它-

So this is what I did: 1) Added a custom plug-in and activated it - http://code.tutsplus.com/tutorials/making-woocommerce-product-attributes-more-prominent--cms-25438

2)尝试通过编辑/wp-content/plugins/woocommerce/templates/single-product/tabs中的tabs.php来删除其他信息"

2) Tried removing "additional information" by editing the tabs.php in /wp-content/plugins/woocommerce/templates/single-product/tabs

/**
 * Removes the "Additional Information" tab that displays the product attributes.
 * 
 * @param array $tabs WooCommerce tabs to display.
 * 
 * @return array WooCommerce tabs to display, minus "Additional Information".
 */
function tutsplus_remove_product_attributes_tab( $tabs ) {

    unset( $tabs['additional_information'] );

    return $tabs;

}

add_filter( 'woocommerce_product_tabs', 'tutsplus_remove_product_attributes_tab', 100 );

这就是我被困住的地方.我什至尝试一起删除extra-information.php文件(在同一选项卡文件夹中),并且仍然显示其他信息!

This is where I'm stuck. I even tried deleting the additional-information.php file all together (in the same tabs folder) and additional information still displays!

我尝试将以上代码放在tabs.php文件的三个不同区域中,但对产品页面上的标签没有影响.

I tried putting the above code in three different areas of the tabs.php file but no effect on the tab on the product page.

还有其他建议吗?也许最新的woocommerce版本有不同/更好的方法?

Any other suggestions? Perhaps there is a different/better method with the latest woocommerce version?

推荐答案

这对我来说可以删除标签:

This worked for me for removing the tabs:

在functions.php中添加此代码:

Adding this in functions.php:

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;

}

要返回要显示在描述下的属性,我无法弄清楚,所以我只是在描述中添加了大小

To return the attributes to display under description, I couldn't figure it out so I just added the sizes in the description

这篇关于Woocommerce:删除“附加信息"标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆