• Resolved WebCodePoet

    (@senjoralfonso)


    Is there a way to use a shortcake like {salutation} in Woocommerce customer dashboard, to say Hello Mr. XY?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author FAKTOR VIER

    (@faktorvier)

    Hi @senjoralfonso

    What do you mean exactly with Woocommerce customer dashboard? Do you mean the “My Account” page every registered and loggedin user can access in the frontend of the shop?

    Thread Starter WebCodePoet

    (@senjoralfonso)

    Jep ??

    Plugin Author FAKTOR VIER

    (@faktorvier)

    Hi @senjoralfonso

    There’s not really an easy way to do this. That would mean that you have to overwrite the theme’s (or the WooCommerce’s default) template file in your own theme and add a few conditions and functions to this copied file.

    Thread Starter WebCodePoet

    (@senjoralfonso)

    Hi, it is not a problem for me to edit this templates, I just need to know, how I get the salutation form the database…

    Thread Starter WebCodePoet

    (@senjoralfonso)

    I hav wrote this so far…

    `<?php $dashboard_welcome = __( ‘Hallo %3$s %1$s (nicht %3$s %1$s? <a href=”%2$s”>Abmelden</a>)’ );
    printf(
    wp_kses( $dashboard_welcome, $allowed_html ),
    ‘<strong>’ . esc_html( $current_user->last_name ) . ‘</strong>’,
    esc_url( wc_logout_url() ),
    esc_html( $current_user->billing_salutation )
    );
    ?>`

    But I don’t not know how I can now translate mr to German “Herr” or mrs to German “Frau”? ??

    Plugin Author FAKTOR VIER

    (@faktorvier)

    You can use the following function instead of $current_user->billing_salutation:

    F4\WCSF\Core\Hooks::get_option_label(get_user_meta($current_user->ID, 'billing_salutation', true))

    If the user has no salutation this would return an empty string though. So maybe its best if you assign the returned value from the function above to a variable and check if its empty and return something else if its empty.

    Hope that helps? Let me know if its working.

    Thread Starter WebCodePoet

    (@senjoralfonso)

    Thank you very much! Works perfekt ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Shortcode’ is closed to new replies.