300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > php sku 代码编写 php – 在单个产品页面中显示SKU下的自定义字段值

php sku 代码编写 php – 在单个产品页面中显示SKU下的自定义字段值

时间:2022-02-06 22:11:04

相关推荐

php sku 代码编写 php  – 在单个产品页面中显示SKU下的自定义字段值

您的问题中提供的代码不完整,应该是这样的:

// Enabling and Displaying Fields in backend

add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );

function woo_add_custom_general_fields() {

global $woocommerce, $post;

echo '

';

woocommerce_wp_text_input( array( // Text Field type

'id' => '_conditions',

'label' => __( 'Conditions', 'woocommerce' ),

'placeholder' => 'i.e: brand-new; refurbished; defected...',

'desc_tip' => 'true',

'description' => __( 'Enter the conditions of the products here.', 'woocommerce' )

) );

woocommerce_wp_text_input( array( // Text Field type

'id' => '_brands', // ===> NOT '_bands'

'label' => __( 'Brands', 'woocommerce' ),

'placeholder' => 'i.e: Lacoste; Hugo Boss...etc',

'desc_tip' => 'true',

'description' => __( 'Enter names of the Brands of the products if any.', 'woocommerce' )

));

echo '

'; // Closing tag HERE

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。