pronetwc
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] how get variable and sned it with email of “new order”Hello,
thanks a lot for your answer ;I have add the meta box , and i have save it to my database ;
my little problem now is that :
when i get the meta as your code : $order->get_meta( ‘your_custom_meta’ );
i haven’t the meta value saved in the database i have just empty; but if i make that code :esc_attr(get_the_author_meta( ‘student_acu_no’, $user->ID )); , i can get the value saved in the database ;
the problem is that when i want to send this value to customer , after the form checkout i can’t get the value and it’s empty too
i show you my entire code :
//////////////////////////////////////////////////////////////////////////
HERE IS HOW ADD THE CUSTOM FIELD
add_action( ‘woocommerce_after_checkout_billing_form’, bbloomer_add_acu_no_if_online_course’ );function bbloomer_add_acu_no_if_online_course( $checkout ) {
$value=’x’;
if ((isset($_GET[‘action’])) AND ($_GET[‘action’]==”save”))
{
$jour=$_POST[‘jour’];$time=$_POST[‘time’];
$value=”$jour à $time”;}
woocommerce_form_field( ‘student_acu_no’, array(
‘type’ => ‘text’,
‘class’ => array(‘student_acu_no form-row-wide’),
‘label’ => __(‘Date heure de livraison’),
‘placeholder’ => __(”),
‘required’ => false,
‘default’ => $value, ),
$checkout->get_value( $value ));
}
//////////////////////////////////////////////////////////////////////////
HERE CODE FOR SAVING TO USER INFOSadd_action(‘woocommerce_checkout_update_user_meta’, ‘bbloomer_checkout_field_update_user_meta’);
function bbloomer_checkout_field_update_user_meta( $user_id ) {
if ($user_id && $_POST[‘student_acu_no’]) update_user_meta( $user_id, ‘student_acu_no’, sanitize_text_field($_POST[‘student_acu_no’]) );}
//////////////////////////////////////////////////////////////////////////
HERE is the code of how i add the variable to email :
—————-
add_action( ‘woocommerce_email_before_order_table’, ‘bbloomer_add_content’, 20, 4 );
function bbloomer_add_content( $order, $sent_to_admin, $plain_text, $email ) {
if ( $email->id == ‘customer_processing_order’ ) {$jourlivraison= esc_attr(get_the_author_meta( ‘student_acu_no’, $user->ID ));
echo ‘<h2 class=”email-upsell-title”>Rdv de Livraison </h2>
<p class=”email-upsell-p”>Merci d etre présent Le “‘.$jourlivraison.’” pour recevoir votre commande</p>’;
}
}
//////////////////////////////////////////////////////////////////////////////
I want to get the value and send it with the email : $jourlivraisonForum: Plugins
In reply to: [WooCommerce] how get variable and sned it with email of “new order”i have add one form before the form of order in the page ( form-checkout.php )
and after validate the form i want to get the variables in the form of checkout then after i want to send thems with the emailthe problem is that i cant get thems i view thems but after send thems i have just space in their place
**************************************************
checkout-form.php
********************************************************
here is code to get the variables in the form of checkout :
if ((isset($_GET[‘action’])) AND ($_GET[‘action’]==”save”))
{
$time=$_POST[‘time’];
$jour=$_POST[‘jour’];
***********************************************************
in functions.php
*************************************************************
add_action( ‘woocommerce_email_before_order_table’, ‘bbloomer_add_content’, 20, 4 );function bbloomer_add_content( $order, $sent_to_admin, $plain_text, $email ) {
if ( $email->id == ‘customer_processing_order’ ) {
/////////////////////////////////////////////////////////////////////////////////////////////
echo ‘<h2 class=”email-upsell-title”>Rdv de Livraison </h2>
<p class=”email-upsell-p”>Merci d etre présent Le “‘.$jour.’ à : ‘.$time.’” pour recevoir votre commande</p>’;
}
}Forum: Plugins
In reply to: [WooCommerce] how get variable and sned it with email of “new order”Thanks for the answer :
I explain more :i want that customer choose a date for delivery for exemple : 20/03/2018 after that he click button ( verify free times for this date ) after that i view just free times that i can delivery for exemple ( 14h00 – 16h00 ) after choosing the time he validate his choice ; i want to get that variables and send thems with email for order
here is my website : http://www.ssd-dz.com/kourssa
you can order one product for teste , in the checkout page you have to select date
and after the time i send you my code ?- This reply was modified 8 years, 2 months ago by pronetwc.