我正在定制WooCommerce,我想在产品页面中添加和显示自定义文本(条件和品牌).
该头寸位于"库存"或"SKU"元下.我已设法创建并保存自定义字段,但如何将这些元值打印到产品页面.
请帮忙!
这是我的代码functions.php:
// Display Fields
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
// Text Field
function woo_add_custom_general_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
woocommerce_wp_text_input(
array(
'id' => '_conditions',
'label' => __( 'Conditions', 'woocommerce' ),
'placeholder' => 'i.e: brand-new; refurbished; defected...',
'desc_tip' => 'true',
'description' => __( 'Enter the conditions of the products here.', 'woocommerce' )
)
);
echo '</div>';
woocommerce_wp_text_input(
array(
'id' => '_bands',
'label' => __( 'Brands', 'woocommerce' ),
'placeholder' => 'i.e: Lacoste; Hugo Boss...etc',
'desc_tip' => …Run Code Online (Sandbox Code Playgroud)