add_action( "woocommerce_email_before_order_table", "custom_woocommerce_email_before_order_table", 10, 1);
function custom_woocommerce_email_before_order_table( $order ) {
echo do_shortcode( '[wcj_order_checkout_field field_id = "billing_wcj_checkout_field_1"]' );
}
also without success!
The Custom Checkout Field (1) is always present in the new-order-email, but after the order table! I want it to show up before the order-content! What is wrong here? I appreciate your help!
//madzzoni
]]>since i use manual payment the client will add (TXID) manually then when click to checkout it should be available in (Transaction Field) like other automatic payments stripe/paypal etc…
i used this code but not showing in the admin order TXID field:
<span class="woocommerce-input-wrapper"><input type="text" class="input-text " name="_transaction_id" id="_transaction_id" placeholder="" value=""></span>
Is it possible with booster to add custom field inside payment method that will update the TXID core field ?
]]>add_action( 'woocommerce_before_order_notes', 'cinses_add_custom_checkout_field' );
function cinses_add_custom_checkout_field( $checkout ) {
if(woo_in_cart(169)) {
$saved_exam_date_practice = $current_user->exam_date_practice;
$args = array(
'post_type' => 'practice-data',
'posts_per_page' => -1,
);
$query = new WP_Query($args);
// Set variable (array)
$options = array();
if ( $query->have_posts() ) :
while ( $query->have_posts() ) : $query->the_post();
$options[get_the_ID()] = get_field('practice-exam-city') . ' ' . get_field('practice-exam-date');
endwhile;
wp_reset_postdata();
endif;
woocommerce_form_field( 'exam_date_practice', array(
'type' => 'select',
'label' => __( 'Datum praktijk examen' ),
'options' => $options,
'required' => true,
'default' => $saved_exam_date_practice,
), $checkout->get_value( 'exam_date_practice' ) );
}
}
And:
add_action( 'woocommerce_checkout_update_order_meta', 'cinses_save_new_checkout_field' );
function cinses_save_new_checkout_field( $order_id ) {
if ( $_POST['exam_date_practice'] ) update_post_meta( $order_id, 'exam_date_practice', esc_attr( $_POST['exam_date_practice'] ) );
}
add_action( 'woocommerce_admin_order_data_after_billing_address', 'cinses_show_new_checkout_field_order', 10, 1 );
function cinses_show_new_checkout_field_order( $order ) {
$order_id = $order->get_id();
if ( get_post_meta( $order_id, 'exam_date_practice', true ) ) echo '<strong>Datum praktijk examen:</strong> ' . get_post_meta( $order_id, 'exam_date_practice', true ) . '
';
}
add_action( 'woocommerce_email_after_order_table', 'cinses_show_new_checkout_field_emails', 20, 4 );
function cinses_show_new_checkout_field_emails( $order, $sent_to_admin, $plain_text, $email ) {
if ( get_post_meta( $order->get_id(), 'exam_date_practice', true ) ) echo '<strong>Datum praktijk examen:</strong> ' . get_post_meta( $order->get_name(), 'exam_date_practice', true ) . '
';
}
Unfortunately this code shows me an ID in the WP admin and confirmation e-mails. How can I display the full date as text?
What I get: “Exam date: 238”
What I want: “Exam date: March 3, 2022”
Thanks for your help in advance!`
]]>add_action( 'woocommerce_before_order_notes', 'cinses_add_custom_checkout_field' );
function cinses_add_custom_checkout_field( $checkout ) {
if(woo_in_cart(169)) {
$saved_exam_date_practice = $current_user->exam_date_practice;
$args = array(
'post_type' => 'practice-data',
'posts_per_page' => -1,
);
$query = new WP_Query($args);
// Set variable (array)
$options = array();
if ( $query->have_posts() ) :
while ( $query->have_posts() ) : $query->the_post();
$options[get_the_ID()] = get_field('practice-exam-city') . ' ' . get_field('practice-exam-date');
endwhile;
wp_reset_postdata();
endif;
woocommerce_form_field( 'exam_date_practice', array(
'type' => 'select',
'label' => __( 'Datum praktijk examen' ),
'options' => $options,
'required' => true,
'default' => $saved_exam_date_practice,
), $checkout->get_value( 'exam_date_practice' ) );
}
}
And:
add_action( 'woocommerce_checkout_update_order_meta', 'cinses_save_new_checkout_field' );
function cinses_save_new_checkout_field( $order_id ) {
if ( $_POST['exam_date_practice'] ) update_post_meta( $order_id, 'exam_date_practice', esc_attr( $_POST['exam_date_practice'] ) );
}
add_action( 'woocommerce_admin_order_data_after_billing_address', 'cinses_show_new_checkout_field_order', 10, 1 );
function cinses_show_new_checkout_field_order( $order ) {
$order_id = $order->get_id();
if ( get_post_meta( $order_id, 'exam_date_practice', true ) ) echo '<p><strong>Datum praktijk examen:</strong> ' . get_post_meta( $order_id, 'exam_date_practice', true ) . '</p>';
}
add_action( 'woocommerce_email_after_order_table', 'cinses_show_new_checkout_field_emails', 20, 4 );
function cinses_show_new_checkout_field_emails( $order, $sent_to_admin, $plain_text, $email ) {
if ( get_post_meta( $order->get_id(), 'exam_date_practice', true ) ) echo '<p><strong>Datum praktijk examen:</strong> ' . get_post_meta( $order->get_name(), 'exam_date_practice', true ) . '</p>';
}
Unfortunately this code shows me an ID in the WP admin and confirmation e-mails. How can I display the full date as text?
What I get: “Exam date: 238”
What I want: “Exam date: March 3, 2022”
Thanks for your help in advance!
]]>Thanks in advance.
]]>we are using a custom checkout field, specifically the radio buttons. Is it possible to change the value from the radio field afterwards in the already made order? So the radio buttons and saved value will be stored also as radio buttons in the order and the shop owner is able to change the value after customer request? For example the radio field shows tuesday/wednesday. The customer choosed tuesday when the order took place but after some weeks the customer wants it to be wednesday. How the shop owner could change it afterwards?
Thank you!
]]>I want to add a Checkbox to my Checkout-Form, which gives the Option to get a small discount but the User can only check the box, when the User is logged in else I want to show the Checkbox but only in a disabled state. Is there any way to add a Custom Checkout-Box
I had something like this in my mind:
$fields['billing']['billing_want_rabat'] = array(
'type' => 'checkbox',
'label' => __('Rabatt-Action only with Account', 'woocommerce'),
'class' => array('form-row-wide'),
'clear' => true,
'disabled' => ((get_current_user_id()) ? false : true) // This don't work is there any other way
);
But I could not find anything like that, it seems that WooCommerce don’t ofer this option.
I would love to know if there is such a function or any way to setup a disabled checkbox in the Checkout form
]]>