• Resolved albans

    (@albans)


    Hi,

    I can’t figure out how to create a new customer via the REST API and set its locale.
    I have tried to set the meta_data “locale” at the same time as I call the post->customers API function, but the “locale” meta_data remains empty. I could not find any example for this in the documentation.

    The only workaround I have been able to use is to create the new customer via WooCommerce REST API, and then use the WordPress API to update the “locale” of the user. But the problem with this model is that the WooCommerce New Account email is only sent out in the default language, as it is triggered before the “locale” is actually updated.

    Is there any way to pass on the “locale” to be used for a new customer when creating it via the WooCommerce REST API?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Luminus Alabi

    (@luminus)

    Automattic Happiness Engineer

    Hi @albans,

    There’s no locale property for WooCommerce customers by default as you set the locale for the entire site.

    If you’re using a plugin to make your site multi-lingual, then you’ll need to look to that plugin for guidance as to how to handle locale settings.

    Thread Starter albans

    (@albans)

    Hi @luminus,

    Thank you for the feedback.

    I actually ended up creating the Customer through the WP API https://developer.wordpress.org/rest-api/reference/users/ , where a LOCALE parameter exists. This actually triggers then the right translation of the Welcome email from WooCommerce.

    Since Core WP offers a LOCALE parameter, I was expecting it as part of WooCommerce API as well, as this doesn’t depend on plugins.

    Regards,

    Alban

    • This reply was modified 6 years, 4 months ago by albans.
    • This reply was modified 6 years, 4 months ago by albans.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘REST API – create new customer and set language’ is closed to new replies.