Hallo,
ich habe für meine variablen Produkte ein eigenes Feld (EAN-Nummer) in der functions.php definiert:
Code
function variation_settings_fields( $loop, $variation_data, $variation ) { // Text Field
woocommerce_wp_text_input(
array(
'id' => '_ean[' . $variation->ID . ']',
'label' => __( 'EAN: ', 'woocommerce' ),
'placeholder' => '',
'desc_tip' => 'true',
'description' => __( 'Bitte EAN Nummer eingeben', 'woocommerce' ),
'value' => get_post_meta( $variation->ID, '_ean', true )
)
);
}
/**
* Save new fields for variations
*
*/
function save_variation_settings_fields( $post_id ) {
// Text Field
$text_field = $_POST['_ean'][ $post_id ];
if( ! empty( $text_field ) ) {
update_post_meta( $post_id, '_ean', esc_attr( $text_field ) );
}
}
add_filter( 'woocommerce_available_variation', 'load_variation_settings_fields' );
/**
* Add custom fields for variations
*
*/
function load_variation_settings_fields( $variations ) {
// duplicate the line for each field
$variations['ean'] = get_post_meta( $variations[ 'variation_id' ], '_ean', true );
return $variations;
}
Alles anzeigen
Wie erreiche ich, dass dieses Feld in der Email einer neuen Bestellung bei jedem Produkt mit ausgegeben wird?
Vielen Dank für eure Hilfe im Voraus.
Gruß