Spring Sale just opened, enjoy your purchase with 20% discount on Themes Bundle. Use Coupon Code spring2022Buy Now

WordPress Website Templates

Find Professional WordPress themes Easy and Simple to Setup

Maria Jesus Abarca Cruz

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • listo y resuelto! al final lo resolví revisando el código del tema en functions.php pero acá debía integrarlo en el código y no al inicio. la solución completa acá : https://gist.github.com/mjesusabarca/71e3c2354152e65c4747c5eed53c51c8

    I would like to edit the php, specifically functions.php to be able to edit the button it says add to the cart. In other themes I have been able to change it from html or from function.php, but this does not work for me. Where should I edit if I want to change the text that says “add to cart”? Any advice or help is welcome. regards

    changes that I would like to add to functions.php or the site in general are as follows:

    add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ );
    function custom_override_checkout_fields( $fields ) {
    $fields[‘order’][‘order_comments’][‘placeholder’] = ‘Plazo requerido y dirección’;
    $fields[‘order’][‘order_comments’][‘label’] = ‘Informe el plazo requerido de arriendo y la dirección donde se utilizarán los Containers’;
    return $fields;
    }
    add_action( ‘woocommerce_after_order_notes’, ‘my_custom_checkout_field’ );
    function my_custom_checkout_field( $checkout ) {
    echo ‘<div id=”my_custom_checkout_field”>’;
    woocommerce_form_field( ‘my_field_name’, array(
    ‘type’ => ‘text’,
    ‘class’ => array(‘my-field-class form-row-wide’),
    ‘label’ => __(‘Rut’),
    ‘placeholder’ => __(‘Ingrese su rut’),
    ), $checkout->get_value( ‘my_field_name’ ));
    echo ‘</div>’;
    }
    add_filter( ‘gettext’, ‘ld_custom_checkout_button_text’, 20, 3 );
    function ld_custom_checkout_button_text( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    case ‘Finalizar compra’ :
    $translated_text = __( ‘Enviar cotización’, ‘woocommerce’ );
    break;
    }
    return $translated_text;
    }
    add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘woo_custom_cart_button_text’ );
    function woo_custom_cart_button_text() {
    global $woocommerce;
    foreach($woocommerce->cart->get_cart() as $cart_item_key => $values ) {
    $_product = $values[‘data’];
    if( get_the_ID() == $_product->id ) {
    return __(‘Solicitar Cotización’, ‘woocommerce’);
    }
    }

    return __(‘Solicitar Cotización’, ‘woocommerce’);
    }

Viewing 2 posts - 1 through 2 (of 2 total)