Function 如何在没有快捷码的情况下将所有产品属性放在下面的描述中

Function 如何在没有快捷码的情况下将所有产品属性放在下面的描述中,function,woocommerce,attributes,Function,Woocommerce,Attributes,目前,我已经使用了这段代码,并在每一篇产品文章中添加了短代码和id add_shortcode("product_attributes", "display_product_attributes"); function display_product_attributes( $atts ) { // Shortcode attribute (or argument) $atts = shortcode_atts( array( 'id'

目前,我已经使用了这段代码,并在每一篇产品文章中添加了短代码和id

add_shortcode("product_attributes", "display_product_attributes");
function display_product_attributes( $atts ) {

    // Shortcode attribute (or argument)
    $atts = shortcode_atts(
        array(
            'id'    => ''
        ),
        $atts, 'product_attributes'
    );

    if( ! ( isset($atts['id']) && $atts['id'] > 0 ) ) return;

    $product = wc_get_product($atts['id']);

    ob_start();

    do_action( 'woocommerce_product_additional_information', $product );

    return ob_get_clean();
}
有人能分享我不需要使用短代码的新代码吗?它会自动在下面的每一篇产品描述文章中显示额外的产品信息吗

示例如下图所示


答案是通过主题覆盖
单一产品/tabs/description.php
woocommerce模板(将模板复制到主题中,如中所述),然后编辑它,并在其中添加
单一产品/产品属性.php
中的一些代码。好的,谢谢@LoicTheAztec,我将尝试创建自己的模板您不需要创建自己的模板,您需要更改现有模板…