nuevaenword
Forum Replies Created
-
Forum: Plugins
In reply to: [Complianz - GDPR/CCPA Cookie Consent] Modify positionHi. Well I’m developing the site for the time being so I prefer not to publish the URL. Could it be possible to send you a capture? Thanks in advance.
Regards
Congratulations!!!!
It works. Thank you very much!!!Regards
Hello Yordan. Thanks for the snippet. What happens now is that the invoice is only generated when the checkbox is marked. I need that the invoice generates always and just send the invoice to the clients that have marked the checkbox. As the administrator I need the invoice. I don’t know if I’m explaining correctly. Thanks in advance
Regards ??
Hi again. I have modified the code I place in my child theme. This time it works perfectly. I just want know, as I have said to send the invoices just to the clients who have marcked the checkbox. Thanks in advance. I provide know the code to you.
Regards ??
”
// A?adir un campo checkbox al checkout y al anadir_estado_pedido_enviado_a_estados add_action( 'woocommerce_review_order_before_submit', 'anadir_campo_checkbox_checkout' ); function anadir_campo_checkbox_checkout() { echo '<div id="campo-factura-pdf">'; woocommerce_form_field( 'cliente_quiere_factura', array( 'type' => 'checkbox', 'class' => array('input-checkbox'), 'label' => __('?Deseas recibir la factura por correo electrónico?'), ), WC()->checkout->get_value( 'cliente_quiere_factura' ) ); echo '</div>'; } // Guardar el campo del checkout en los meta del pedido, cuando se ha checkeado el checkbox add_action( 'woocommerce_checkout_update_order_meta', 'actualizar_meta_campo_checkout_factura', 10, 1 ); function actualizar_meta_campo_checkout_factura( $order_id ) { if ( ! empty( $_POST['cliente_quiere_factura'] ) ) update_post_meta( $order_id, 'cliente_quiere_factura', $_POST['cliente_quiere_factura'] ); } // Mostrar el resultado del campo checkout en el admin del pedido add_action( 'woocommerce_admin_order_data_after_billing_address', 'mostrar_campo_checkout_detalles_pedido_admin', 10, 1 ); function mostrar_campo_checkout_detalles_pedido_admin( $order ){ $cliente_quiere_factura = get_post_meta( $order->get_id(), 'cliente_quiere_factura', true ); if( $cliente_quiere_factura == 1 ) { echo '<p><strong>?Quiere factura por email?: </strong> <span style="color:red;">SI</span></p>'; } else { echo '<p><strong>?Quiere factura por email?: </strong> <span style="color:black;">NO</span></p>'; } }
“
Hi @depeyou,
Thanks for your reply. I find the plugin you propose very complex and I don’t know how to make it work.I’m going to display what I’m traying to do just in case you could help me.
Well. I need to place a checkbox with the label “Deseo recibir mi factura por correo electrónico” in some place in de Checkout page. At the same time I need to save the value of this checkbox in order to do two things:
One, to place “Deseo recibir mi factura por correo electrónico” + (this value) in the note that WooCommerce sends to the client once the process has taken place. Because I need to store a prove of that decission.
Two, to send the invoice by email just in case the client has marked the check box.
I prefer to do this by means of code than just instal more plugins.
In the functions.php file inside my child theme I’ve place the following script:
“add_action(‘woocommerce_after_order_notes’, ‘my_custom_checkout_field’);
function my_custom_checkout_field( $checkout ) {
woocommerce_form_field( ‘my_checkbox’, array(
‘type’ => ‘checkbox’,
‘class’ => array(‘input-checkbox’),
‘label’ => __(‘Deseo recibir mi factura por correo electrónico’), // Pon el mensaje despues de la caja o checkbox
‘required’ => false, // Pon true si quieres que sea obligatorio y false para opcional
), $checkout->get_value( ‘my_checkbox’ ));
}
add_action(‘woocommerce_checkout_process’, ‘my_custom_checkout_field_process’);function my_custom_checkout_field_process() {
global $woocommerce;
}
”
It works, the check box is added in the checkout page.Then in order to recober the value and place it in the billing note I add:
”
/**
* Campo personalizado para el checkoutadd_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[‘my_checkbox’]) update_post_meta( $order_id, ‘Deseo recibir mi factura por correo electrónico’, esc_attr($_POST[‘my_checkbox’])); // Cambia aquí el nombre del campo
}
**/
/**
* A?adir campos personalizados en el email de ordenes
*/
add_filter( ‘woocommerce_email_order_meta_fields’, ‘custom_woocommerce_email_order_meta_fields’, 10, 3 );function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
$fields[‘my_checkbox’] = array(
‘label’ => __( ‘Deseo recibir mi factura por correo electrónico’ ),
‘value’ => get_post_meta( $order->id, ‘my_checkbox’, true ),
);
return $fields;
}
”
But this doesn’t work. Could you help me with this and in addition provide a way to make “WooCommerce PDF Invoices and Packing Slips” send the email to the client when the value is “Yes”. thanks in advance.Regards
Hi. I have solved the problem just creating my own temmplate in my child theme. I supose it is goin to persist when the plugin updates. Isn’t it? Thanks in advance.
Regards
Hi. Well. I don’t know exactly where it is stored. I’m using the plugin WooCommerce Checkout Field Editor Pro. I’m in the section titled Billing Fields. I have created a radio button with the label “Deseo recibir mi factura por correo electrónico” and two values “Si” and “No”. I would apreciate very much if you had any sugestion about the implementation of this checkbox by means of code in the file functions.php of mi child theme if you consider the integration with the plugin would be better. Thanks in advance.
Regards
Forum: Plugins
In reply to: [PDF Invoices & Packing Slips for WooCommerce] Distintas series numeraciónThank you very much.
Yes, it could be by SKU.Regards