@axelthedon
You may have to custom code it on your end. It would not be directly possible as of now.
Do let me know if you need any help further.
@axelthedon ,
We have taken a note of this feature and we will add it in later releases.
/**
* Add checkbox field to the checkout
**/
add_action('woocommerce_checkout_after_terms_and_conditions', 'my_custom_checkout_field');
function my_custom_checkout_field() {
?>
<div id="field-publicitate">
<p class="form-row input-checkbox" id="check_publicitate_field" data-priority="">
<span class="woocommerce-input-wrapper"><label class="checkbox ">
<input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="check_publicitate" id="check_publicitate" value="1"> Doresc să primesc mesaje publicitare și de marketing.</label>
</span>
</p>
</div>
<?php
}
/**
* Update the order meta with field value
**/
add_action('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta');
function my_custom_checkout_field_update_order_meta( $order_id ) {
if ($_POST['check_publicitate']){
$subs_email = esc_attr($_POST['billing_email']);
$subs_name = esc_attr($_POST['billing_last_name']);
$form['es_email_name'] = $subs_name;
$form['es_email_mail'] = $subs_email;
$form['es_email_group'] = "Subs";
$form['es_email_status'] = "Confirmed";
$form['es_nonce'] = wp_create_nonce( 'es-subscribe' );
$action = es_cls_dbquery::es_view_subscriber_ins($form, "insert");
}
}
Use this in functions.php
-
This reply was modified 7 years, 10 months ago by
adryyy.
-
This reply was modified 7 years, 10 months ago by
adryyy.