the problem I is that I always see success response allways I don`t see any issue allways success true product added to cart successfully
this is the result I get from this code :
this is the code that send product id and product quantity to add it to cart
this is the backend code :
]]>Unser Shop l?uft seit Jahren meist problemfrei mit Woocommerce auf WordPress. Seit kurz nach Weihnachten versendet WooCommerce keine Mails mehr, weder an den Kunden noch an uns. Die Bestellungen k?nnen trotzdem ordentlich abgeschlossen werden. Mails von WordPress (zB zur Statistik der Newsletter) bekommen wir noch.
Ich habe unter WooCommerce>Einstellungen>E-Mails nichts ge?ndert. Jetzt zum Test habe ich die dort bisher genutzte Mailadresse mal gegen meine Standardadresse bei web.de getauscht, hat nichts ge?ndert.
Habe auch schon alle PlusIns (ausser WooC) deaktiviert, auch keine ?nderung.
Bringt es euch was, wenn ich access_log_20231224-20240105.gz hier hochlade?
Hat jemand noch eine Idee, woran es liegen k?nnte?
Danke euch und viele Grü?e,
Mara
]]>I have checked my Gmail spam folder and all mail sections thoroughly, but I couldn’t find any emails from my WooCommerce store. However, interestingly, when I used a temporary email address, I received the emails successfully in the temporary email inbox.
Could you please assist me in resolving this issue? I would greatly appreciate any guidance or suggestions you can provide to help me receive WooCommerce emails in my Gmail inbox as intended.
this image is from a temp-mail website, as you can see this is emails from my website, but in my gmail inbox i don’t receive anything
]]>I have plugin setup and configured but while going to test connection, it throws error of Invalid username/password even same user pass is working fine to login on https://www.freightquote.com/
I do not see any shipping options to appear on front.
Please help!
]]>I would like to know how I make make the woocommerce long product description excerpt. Like For example: Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College…<more>
When people click more the full text opens. Till clicking more it should be collapsed.
Thanks in advanced.
]]>The problem I’m facing is, that when I try to update PublishPress’s custom fields (“expire-date, _expiration-date”) of the products that are already in the draft, with WP All Import – the custom fields are not updated.
Let me clearfiy how I come across the mentioned problem:
The problem started occuring in the previous month, once I’ve updated the woocommerce to 7.9 and php to 8.2.
Can anyone help me with the metioned problem?
Best regards!
]]>I am creating a new website for a customer. For that I am using the WooCommerce plugin on Worpdress to connect with Colissimo. Now I am wondering, can I connect the already existing Colissimo account of the customer? If yes, how is that done?
Many thanks!
My client is getting this message:
Heads up! Your connection to Facebook is no longer valid. Heads up! Your connection to Facebook is no longer valid.
It the plugin it actually says it is connected, and I have the following settings:
Page ID
Pixel ID
Catalog ID
Business Manager Account ID
Commerce Merchant Settings ID
Instagram ID
The Facebook Shop BUTTON has NOT viewed for some time on Facebook account for some reason and I haven’t been able to resolve that.
I have another client we have NO issues seeing the Facebook Shop button etc.
Not sure WHY it is giving this error to reconnect. Do I just do it and it will work ?
All products are viewed in the Catalogue.
Thanks
Kristin
I am working on this website https://www.moto-loko.com/ and the staging site is https://woocommerce-283334-1014241.cloudwaysapps.com/
https://www.moto-loko.com/product/
https://www.moto-loko.com/product-category
products and kits on all those pages. And add to cart process is slow.
I have given a lot of effort, did the CSS, js minification, or delay delivery, image optimization and even tried Cloudflare. The website loads fine but the woocommerce products pages, products, and the add-to-cart process are so slow. I have tried various ways but in vain. I need support from expert people here, and hopefully, will get the speed optimization done. Thank you so much.
]]><?php
//Custom WooCommerce Checkout Fields based on Quantity
add_action( 'woocommerce_before_order_notes', 'person_details' );
function person_details($checkout) {
global $woocommerce;
$items = $woocommerce->cart->get_cart();
$i = 1;
foreach($items as $item => $values) {
$_product = $values['data']->post;
$quantity = $values['quantity'];
$x = 1;
while ($x <= $quantity) {
echo '<div class="Attendee-group"><h4>'. __('<span class="attendee-title">Attendee ' . $x . ' - </span>' ) . $_product->post_title .'</h4>';
//firstname
woocommerce_form_field( 'attendee_product_title_' . $x, array(
'type' => 'hidden',
'class' => array('attendee form-row-first'),
// 'label' => __('Attendee product title '),
'placeholder' => __(''),
'required' => true,
'value' => 'test',
'default' => " $_product->post_title "
), $checkout->get_value( 'attendee_product_title_' . $x ) );
woocommerce_form_field( 'attendee_first_name_' . $x, array(
'type' => 'text',
'class' => array('attendee form-row-first'),
'label' => __('First Name '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'attendee_first_name_' . $x ) );
// lastname
woocommerce_form_field( 'attendee_last_name_' . $x, array(
'type' => 'text',
'class' => array('attendee form-row-last'),
'label' => __('Last Name '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'attendee_last_name_' . $x ));
//email
woocommerce_form_field( 'attendee_email_' . $x, array(
'type' => 'email',
'class' => array('attendee form-row-wide'),
'label' => __('Email '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'attendee_email_' . $x ));
//phone
woocommerce_form_field( 'attendee_phone_' . $x, array(
'type' => 'text',
'class' => array('attendee form-row-wide'),
'label' => __('Phone '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'attendee_phone_' . $x ));
//DOB
woocommerce_form_field( 'attendee_dob_' . $x, array(
'type' => 'date',
'class' => array('attendee form-row-first'),
'label' => __('DOB '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'attendee_dob_' . $x ));
//gender
woocommerce_form_field( 'attendee_gender_' . $x, array(
'type' => 'select',
'class' => array('my-field-class form-row-last'),
'label' => __('Gender'),
'required' => true,
'options' => array(
'blank' => __( '--'),
'Male' => __( 'Male'),
'Female' => __( 'Female'),
'Others' => __( 'Others' )
)
), $checkout->get_value( 'attendee_gender_' . $x ));
//Address one
woocommerce_form_field( 'attendee_address_1_' . $x, array(
'type' => 'text',
'class' => array('attendee form-row-wide'),
'label' => __('Address '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'attendee_address_1_' . $x ));
//Address 2
woocommerce_form_field( 'attendee_address_2_' . $x, array(
'type' => 'text',
'class' => array('attendee form-row-wide'),
'label' => __('Apartment, Suite, etc. '),
'placeholder' => __(''),
), $checkout->get_value( 'attendee_address_2_' . $x ));
//City
woocommerce_form_field( 'attendee_city_' . $x, array(
'type' => 'text',
'class' => array('attendee form-row-wide address-field'),
'label' => __('Suburb/City '),
'placeholder' => __(''),
), $checkout->get_value( 'attendee_city_' . $x ));
//State
woocommerce_form_field( 'attendee_state_' . $x, array(
'type' => 'select',
'class' => array('attendee form-row-wide address-field'),
'label' => __('State/Territory'),
'required' => true,
'options' => array(
'blank' => __( '--'),
'Australian Capital Territory' => __( 'Australian Capital Territory'),
'New South Wales' => __( 'New South Wales'),
'Northern Territory' => __( 'Northern Territory' ),
'Queensland' => __( 'Queensland' ),
'Tasmania' => __( 'South Australia' ),
'Northern Territory' => __( 'Tasmania' ),
'Victoria' => __( 'Victoria' ),
'Western Australia' => __( 'Western Australia' ),
)
), $checkout->get_value( 'attendee_gender_' . $x ));
//Passcode
woocommerce_form_field( 'attendee_postcode_' . $x, array(
'type' => 'text',
'class' => array('attendee form-row-wide address-field'),
'label' => __('Postcode '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'attendee_postcode_' . $x ));
echo '<div class="Attendee-group-funding-type"><h4>Funding Type*</h4>'; echo '</div>';
woocommerce_form_field( '_funding_type_radio_'. $x, array(
'type' => 'radio',
'class' => array('funding-type-radio'),
'required' => 'required',
'options' => array(
'Self_managed' => __( 'Self-managed'),
'Plan_managed' => __( 'Plan-managed'),
'Ndia_managed' => __( 'NDIA-managed' ),
),
// 'default' => 'Self_managed',
), $checkout->get_value( '_funding_type_radio_' . $x ));
echo '<div class=" funding-type-description"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco labori</p></div>';
// echo "<script>alert('message');</script>";
//funding type radio ending
echo '<div class="self_manage_funding_text Attendee-group">';
//self manage
echo '<div class="Attendee-group"><h4>Self-managed details for invoicing</h4></div>';
//firstname
woocommerce_form_field( 'self_managed_funding_type_attendee_first_name_' . $x, array(
'type' => 'text',
'class' => array('form-row-first'),
'label' => __('First Name '),
'placeholder' => __(''),
'required' => true,
), $user, $checkout->get_value( 'self_managed_funding_type_attendee_first_name_' . $x ) );
// lastname
woocommerce_form_field( 'self_managed_funding_type_attendee_last_name_' . $x, array(
'type' => 'text',
'class' => array('form-row-last'),
'label' => __('Last Name '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'self_managed_funding_type_attendee_last_name_' . $x ));
//email
woocommerce_form_field( 'self_managed_funding_type_attendee_email_' . $x, array(
'type' => 'email',
'class' => array('form-row-wide'),
'label' => __('Email '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'self_managed_funding_type_attendee_email_' . $x ));
//phone
woocommerce_form_field( 'self_managed_funding_type_attendee_phone_' . $x, array(
'type' => 'text',
'class' => array('form-row-wide'),
'label' => __('Phone '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'self_managed_funding_type_attendee_phone_' . $x ));
//DOB
woocommerce_form_field( 'self_managed_funding_type_attendee_dob_' . $x, array(
'type' => 'date',
'class' => array('form-row-first'),
'label' => __('DOB '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'self_managed_funding_type_attendee_dob_' . $x ));
//gender
woocommerce_form_field( 'self_managed_funding_type_attendee_gender_' . $x, array(
'type' => 'select',
'class' => array('form-row-last'),
'label' => __('Gender'),
'required' => true,
'options' => array(
'blank' => __( '--'),
'Male' => __( 'Male'),
'Female' => __( 'Female'),
'Others' => __( 'Others' )
)
), $checkout->get_value( 'self_managed_funding_type_attendee_gender_' . $x ));
//Address one
woocommerce_form_field( 'self_managed_funding_type_attendee_address_1_' . $x, array(
'type' => 'text',
'class' => array('form-row-wide'),
'label' => __('Address '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'self_managed_funding_type_attendee_address_1_' . $x ));
//Address 2
woocommerce_form_field( 'self_managed_funding_type_attendee_address_2_' . $x, array(
'type' => 'text',
'class' => array('form-row-wide'),
'label' => __('Apartment, Suite, etc. '),
'placeholder' => __(''),
), $checkout->get_value( 'self_managed_funding_type_attendee_address_2_' . $x ));
//City
woocommerce_form_field( 'self_managed_funding_type_attendee_city_' . $x, array(
'type' => 'text',
'class' => array('form-row-wide address-field'),
'label' => __('Suburb/City '),
'placeholder' => __(''),
), $checkout->get_value( 'self_managed_funding_type_attendee_city_' . $x ));
//State
woocommerce_form_field( 'self_managed_funding_type_attendee_state_' . $x, array(
'type' => 'select',
'class' => array('form-row-wide address-field'),
'label' => __('State/Territory'),
'required' => true,
'options' => array(
'blank' => __( '--'),
'Australian Capital Territory' => __( 'Australian Capital Territory'),
'New South Wales' => __( 'New South Wales'),
'Northern Territory' => __( 'Northern Territory' ),
'Queensland' => __( 'Queensland' ),
'Tasmania' => __( 'South Australia' ),
'Northern Territory' => __( 'Tasmania' ),
'Victoria' => __( 'Victoria' ),
'Western Australia' => __( 'Western Australia' ),
)
), $checkout->get_value( 'self_managed_funding_type_attendee_state_' . $x ));
//Passcode
woocommerce_form_field( 'self_managed_funding_type_attendee_postcode_' . $x, array(
'type' => 'text',
'class' => array('form-row-wide address-field'),
'label' => __('Postcode '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'self_managed_funding_type_attendee_postcode_' . $x ));
echo '</div>';
//plan manage funding type
echo '<div class="plan-managed-funding-text Attendee-group">';
//self manage
echo '<div class="plan-managed-funding-text Attendee-group"><h4>Plan Managed</h4></div>';
//firstname
woocommerce_form_field( 'plan_managed_funding_type_attendee_first_name_' . $x, array(
'type' => 'text',
'class' => array('plan-managed-funding-text form-row-first'),
'label' => __('First Name '),
'placeholder' => __(''),
'required' => true,
), $user, $checkout->get_value( 'plan_managed_funding_type_attendee_first_name_' . $x ) );
// lastname
woocommerce_form_field( 'plan_managed_funding_type_attendee_last_name_' . $x, array(
'type' => 'text',
'class' => array('plan-managed-funding-text form-row-last'),
'label' => __('Last Name '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'plan_managed_funding_type_attendee_last_name_' . $x ));
//email
woocommerce_form_field( 'plan_managed_funding_type_attendee_email_' . $x, array(
'type' => 'email',
'class' => array('plan-managed-funding-text form-row-wide'),
'label' => __('Email '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'plan_managed_funding_type_attendee_email_' . $x ));
//phone
woocommerce_form_field( 'plan_managed_funding_type_attendee_phone_' . $x, array(
'type' => 'text',
'class' => array('plan-managed-funding-text form-row-wide'),
'label' => __('Phone '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'plan_managed_funding_type_attendee_phone_' . $x ));
//DOB
woocommerce_form_field( 'plan_managed_funding_type_attendee_dob_' . $x, array(
'type' => 'date',
'class' => array('atteplan-managed-funding-text form-row-first'),
'label' => __('DOB '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'plan_managed_funding_type_attendee_dob_' . $x ));
//gender
woocommerce_form_field( 'plan_managed_funding_type_attendee_gender_' . $x, array(
'type' => 'select',
'class' => array('plan-managed-funding-text form-row-last'),
'label' => __('Gender'),
'required' => true,
'options' => array(
'blank' => __( '--'),
'Male' => __( 'Male'),
'Female' => __( 'Female'),
'Others' => __( 'Others' )
)
), $checkout->get_value( 'plan_managed_funding_type_attendee_gender_' . $x ));
//Address one
woocommerce_form_field( 'plan_managed_funding_type_attendee_address_1_' . $x, array(
'type' => 'text',
'class' => array('plan-managed-funding-text form-row-wide'),
'label' => __('Address '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'plan_managed_funding_type_attendee_address_1_' . $x ));
//Address 2
woocommerce_form_field( 'plan_managed_funding_type_attendee_address_2_' . $x, array(
'type' => 'text',
'class' => array('plan-managed-funding-text form-row-wide'),
'label' => __('Apartment, Suite, etc. '),
'placeholder' => __(''),
), $checkout->get_value( 'plan_managed_funding_type_attendee_address_2_' . $x ));
//City
woocommerce_form_field( 'plan_managed_funding_type_attendee_city_' . $x, array(
'type' => 'text',
'class' => array('plan-managed-funding-text form-row-wide address-field'),
'label' => __('Suburb/City '),
'placeholder' => __(''),
), $checkout->get_value( 'plan_managed_funding_type_attendee_city_' . $x ));
//State
woocommerce_form_field( 'plan_managed_funding_type_attendee_state_' . $x, array(
'type' => 'select',
'class' => array('plan-managed-funding-text form-row-wide address-field'),
'label' => __('State/Territory'),
'required' => true,
'options' => array(
'blank' => __( '--'),
'Australian Capital Territory' => __( 'Australian Capital Territory'),
'New South Wales' => __( 'New South Wales'),
'Northern Territory' => __( 'Northern Territory' ),
'Queensland' => __( 'Queensland' ),
'Tasmania' => __( 'South Australia' ),
'Northern Territory' => __( 'Tasmania' ),
'Victoria' => __( 'Victoria' ),
'Western Australia' => __( 'Western Australia' ),
)
), $checkout->get_value( 'plan_managed_funding_type_attendee_state_' . $x ));
//Passcode
woocommerce_form_field( 'plan_managed_funding_type_attendee_postcode_' . $x, array(
'type' => 'text',
'class' => array('plan-managed-funding-text form-row-wide address-field'),
'label' => __('Postcode '),
'placeholder' => __(''),
'required' => true,
), $checkout->get_value( 'plan_managed_funding_type_attendee_postcode_' . $x ));
echo '</div>';
echo '<div class="ndia-managed-funding-text Attendee-group">';
//self manage
echo '<div class="ndia-managed-funding-text Attendee-group"><h4>NDIA-managed details </h4></div>';
//firstname
woocommerce_form_field( 'ndia_managed_funding_type_attendee_ndia_number_' . $x, array(
'type' => 'text',
'class' => array('ndia-managed-funding-text form-row-first'),
'label' => __('NDIA Number (If applicable) '),
'placeholder' => __(''),
), $checkout->get_value( 'ndia_managed_funding_type_attendee_ndia_number_' . $x ) );
echo '</div>';
echo '</div>';
//funding type starting
$x++;
}
$i++;
}
}
/**
* Save value of fields
*/
add_action('woocommerce_checkout_update_order_meta', 'customise_checkout_field_update_order_meta');
function customise_checkout_field_update_order_meta($order_id) {
global $woocommerce;
$items = $woocommerce->cart->get_cart();
$i = 1;
foreach($items as $item => $values) {
$_product = $values['data']->post;
$quantity = $values['quantity'];
$x = 1;
while ($x <= $quantity) {
if (!empty($_POST['attendee_product_title_'.$x])) {
update_post_meta($order_id, 'Tour Title of Attendee'.$x, sanitize_text_field($_POST['attendee_product_title_'.$x]) );
}
if (!empty($_POST['attendee_first_name_'.$x])) {
update_post_meta($order_id, 'First Name of Attendee'.$x, sanitize_text_field($_POST['attendee_first_name_'.$x]) );
}
if (!empty($_POST['attendee_last_name_'.$x])) {
update_post_meta($order_id, 'Last Name of Attendee'.$x, sanitize_text_field($_POST['attendee_last_name_'.$x]));
}
if (!empty($_POST['attendee_email_'.$x])) {
update_post_meta($order_id, 'Email of Attendee'.$x, sanitize_text_field($_POST['attendee_email_'.$x]));
}
if (!empty($_POST['attendee_phone_'.$x])) {
update_post_meta($order_id, 'Phone Number of Attendee'.$x, sanitize_text_field($_POST['attendee_phone_'.$x]));
}
if (!empty($_POST['attendee_dob_'.$x])) {
update_post_meta($order_id, 'DOB of Attendee'.$x, sanitize_text_field($_POST['attendee_dob_'.$x]));
}
if (!empty($_POST['attendee_gender_'.$x])) {
update_post_meta($order_id, 'Gender of Attendee'.$x, sanitize_text_field($_POST['attendee_gender_'.$x]));
}
if (!empty($_POST['attendee_address_1_'.$x])) {
update_post_meta($order_id, 'Address 1 of Attendee'.$x, sanitize_text_field($_POST['attendee_address_1_'.$x]));
}
if (!empty($_POST['attendee_address_2_'.$x])) {
update_post_meta($order_id, 'Address 2 of Attendee'.$x, sanitize_text_field($_POST['attendee_address_2_'.$x]));
}
if (!empty($_POST['attendee_city_'.$x])) {
update_post_meta($order_id, 'City of Attendee'.$x, sanitize_text_field($_POST['attendee_city_'.$x]));
}
if (!empty($_POST['attendee_state_'.$x])) {
update_post_meta($order_id, 'State of Attendee'.$x, sanitize_text_field($_POST['attendee_state_'.$x]));
}
if (!empty($_POST['attendee_postcode_'.$x])) {
update_post_meta($order_id, 'Postcode of Attendee'.$x, sanitize_text_field($_POST['attendee_postcode_'.$x]));
}
if (!empty($_POST['_funding_type_radio_'.$x])) {
update_post_meta($order_id, 'Funding Type of Attendee'.$x, sanitize_text_field($_POST['_funding_type_radio_'.$x]));
}
//self manage funding type start
if (!empty($_POST['self_managed_funding_type_attendee_first_name_'.$x])) {
update_post_meta($order_id, 'Self-Managed First Name of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_first_name_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_last_name_'.$x])) {
update_post_meta($order_id, 'Self-Managed Last Name of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_last_name_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_email_'.$x])) {
update_post_meta($order_id, 'Self-Managed Email of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_email_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_phone_'.$x])) {
update_post_meta($order_id, 'Self-Managed Phone Number of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_phone_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_dob_'.$x])) {
update_post_meta($order_id, 'Self-Managed DOB of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_dob_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_gender_'.$x])) {
update_post_meta($order_id, 'Self-Managed Gender of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_gender_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_address_1_'.$x])) {
update_post_meta($order_id, 'Self-Managed Address 1 of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_address_1_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_address_2_'.$x])) {
update_post_meta($order_id, 'Self-Managed Address 2 of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_address_2_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_city_'.$x])) {
update_post_meta($order_id, 'Self-Managed City of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_city_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_state_'.$x])) {
update_post_meta($order_id, 'Self-Managed State of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_state_'.$x]));
}
if (!empty($_POST['self_managed_funding_type_attendee_postcode_'.$x])) {
update_post_meta($order_id, 'Self-Managed Postcode of Attendee'.$x, sanitize_text_field($_POST['self_managed_funding_type_attendee_postcode_'.$x]));
}
//self manage funding type end
//plan manage funding type start
if (!empty($_POST['plan_managed_funding_type_attendee_first_name_'.$x])) {
update_post_meta($order_id, 'Plan-Managed First Name of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_first_name_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_last_name_'.$x])) {
update_post_meta($order_id, 'Plan-Managed Last Name of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_last_name_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_email_'.$x])) {
update_post_meta($order_id, 'Plan-Managed Email of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_email_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_phone_'.$x])) {
update_post_meta($order_id, 'Plan-Managed Phone Number of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_phone_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_dob_'.$x])) {
update_post_meta($order_id, 'Plan-Managed DOB of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_dob_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_gender_'.$x])) {
update_post_meta($order_id, 'Plan-Managed Gender of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_gender_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_address_1_'.$x])) {
update_post_meta($order_id, 'Plan-Managed Address 1 of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_address_1_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_address_2_'.$x])) {
update_post_meta($order_id, 'Plan-Managed Address 2 of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_address_2_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_city_'.$x])) {
update_post_meta($order_id, 'Plan-Managed City of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_city_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_state_'.$x])) {
update_post_meta($order_id, 'Plan-Managed State of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_state_'.$x]));
}
if (!empty($_POST['plan_managed_funding_type_attendee_postcode_'.$x])) {
update_post_meta($order_id, 'Plan-Managed Postcode of Attendee'.$x, sanitize_text_field($_POST['plan_managed_funding_type_attendee_postcode_'.$x]));
}
//end plan managed
// start ndia managed
if (!empty($_POST['ndia_managed_funding_type_attendee_ndia_number_'.$x])) {
update_post_meta($order_id, 'Plan-Managed First Name of Attendee'.$x, sanitize_text_field($_POST['ndia_managed_funding_type_attendee_ndia_number_'.$x]));
}
$x++;
}
$i++;
}
}
/**
* Add fields to order emails
**/
add_action('woocommerce_email_order_meta_keys', 'my_custom_checkout_field_order_meta_keys');
function my_custom_checkout_field_order_meta_keys( $keys ) {
global $woocommerce;
$items = $woocommerce->cart->cart_contents_count;
$x = 1;
foreach(WC()->cart->get_cart() as $items => $values) {
$_product = $values['data']->post;
$quantity = $values['quantity'];
// $start_date = get_field('tour_start_date' , $_product);
// $end_date = get_field('tour_end_date' , $_product);
// $terms = get_the_terms( $_product, 'location' );
$x = 1;
while ($x <= $quantity) {
echo '<div class="Attendee-group"><h4>'. __('<span class="attendee-title">Attendee ' . $x . ' - </span>' ) . $_product->post_title .'</h4>';
$keys[] = 'First Name of Attendee'.$x;
$keys[] = 'Last Name of Attendee'.$x;
$keys[] = 'Funding Type of Attendee'.$x;
echo '</div>';
$x++;
}
$x++;
} return $keys;
}
// $x++;
// }
// }
// return $keys;
// }
// add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 );
// function custom_woocommerce_email_order_meta_fields( $keys, $sent_to_admin, $order ) {
// $x = 0;
// for($k=1; $k<= 50; $k++) {
// $x++;
// echo '<div class="ndia-managed-funding-text Attendee-group"><h3>Name of Attendee' .$x. '</h3>';
// $keys['attendee_first_name_'] = array(
// 'label' => __( 'First of Attendee' ),
// 'value' => get_post_meta( $order->id, 'attendee_first_name_', true ),
// );
// $keys['attendee_first_name_'] = array(
// 'label' => __( 'Last of Attendee' ),
// 'value' => get_post_meta( $order->id, 'attendee_last_name_', true ),
// );
// echo '</div>';
// }
// return $keys;
// }
]]>