Hello, I have inserted this php snippet to insert a check box to be accepted with some conditions of use.
// Mostrar campo obligatorio Términos y condiciones en el checkout
// @autora - Ruth Gascón https://ruthgascon.com
function anadir_terminos_checkout() {
woocommerce_form_field( 'terminos_condiciones', array(
'type' => 'checkbox',
'required' => true,
'label' => __('He leído y acepto las <a target="blank" href="https://autotrabajo.com/condiciones-de-contratacion/">condiciones generales de contratación.</a>'),
));
}
add_action( 'woocommerce_review_order_before_submit', 'anadir_terminos_checkout', 9 );
// Mostrar mensaje de error si no se aceptan los Términos y condiciones
function mostrar_error_terminos() {
if ( ! (int) isset( $_POST['terminos_condiciones'] ) ) {
wc_add_notice(('Por favor acepta las condiciones generales de contratación'), 'error');
}
}
add_action( 'woocommerce_checkout_process', 'mostrar_error_terminos' );
// Añade campo en el pedido
function anadir_campo_terminos_en_pedido( $order_id ) {
if ( ! empty( $_POST['terminos_condiciones'] ) ) {
update_post_meta( $order_id, 'Terminos y condiciones aceptadas', sanitize_text_field( $_POST['terminos_condiciones'] ) );
}
}
add_action( 'woocommerce_checkout_update_order_meta', 'anadir_campo_terminos_en_pedido' );
But I would like to insert another one like this in the Experthive screen to add a new ad. So that it appears at the bottom of the screen after filling in all the fields. Can you help me to know what function or line I have to change in my previous code so that it appears there.
Thank you very much.
Translated with DeepL Translate: The world's most accurate translator (free version)