admin管理员组文章数量:1313347
I have a custom field such as "_additional_description", I need to display it at the end of the product description, but only if the product is simple.
Thank you for your help
I have a custom field such as "_additional_description", I need to display it at the end of the product description, but only if the product is simple.
Thank you for your help
Share Improve this question asked Dec 5, 2020 at 11:26 Tomáš SpisarTomáš Spisar 11 Answer
Reset to default 0You can take the help of hooks WooCommerce provides. Here is the link to the visual hook guide https://www.businessbloomer/woocommerce-visual-hook-guide-single-product-page/
Here is the code that suits your need.
add_action( 'woocommerce_after_single_product_summary', function() {
global $product;
if ( $product->is_type( 'simple' ) ) {
get_post_meta( get_the_ID(), '_additional_description' );
}
} );
I hope it helps.
本文标签: postsHow to display custom field in product description
版权声明:本文标题:posts - How to display custom field in product description? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741940114a2406094.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论