• Resolved eddwhomst

    (@eddwhomst)


    Hi,

    When I use this endpoint API, I can successfully create a new user with curl but it doesn’t send a link, to the new user’s email, to choose a password. It simply sends a welcome email with a domain link.

    When I dig into the settings on how this email is generated, at my domain’s /wp-admin/admin.php?page=wc-settings&tab=email&section=wc_email_customer_new_account,
    I find the following an interesting clue

    <?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?>
    	<?php /* translators: %s: Auto generated password */ ?>
    	<p><?php printf( esc_html__( 'Your password has been automatically generated: %s', 'woocommerce' ), '<strong>' . esc_html( $user_pass ) . '</strong>' ); ?></p>
    <?php endif; ?>

    But I’m not able to trigger the auto-generate password. If I try to modify woocommerce_registration_generate_password option to yes using /wp-admin/options.php, saving just reverts back to no. But, I’m not 100% sure if this is relevant because if I manually create a user, an email is sent with a “click here to set your password”.
    Trying to add additional payloads to affect email generation failed
    curl --request POST -H "woocommerce_registration_generate_password: yes" -H "x-woocommerce_registration_generate_password: yes" "https://domain.tld//wp-json/wc/v3/customers?params=" -d '{"meta_data": [{"woocommerce_registration_generate_password": "yes"}], "woocommerce_meta": {"woocommerce_registration_generate_password": "yes"}}'

    What is the correct way to create a user, that’ll send a “please choose a password” email, using curl?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Zworthkey

    (@zworthkey)

    hello,

    Please try to go to the settings tab or just updated the option values of woocommerce_registration_generate_password with value yes.?

    ‘yes’ === get_option( ‘woocommerce_registration_generate_password’ )

    to update it

    update_option( ‘woocommerce_registration_generate_password’ ,’yes’ );

    try this if not work lemme know I’ll try to debug with other more possibilities too.

    Thanks And Regards

    Thread Starter eddwhomst

    (@eddwhomst)

    When I modify woocommerce_registration_generate_password to “yes”, in the settings menu, it immediately reverts back to “no” after I hit save.

    Hi @eddwhomst,

    If the settings won’t update, that’s typically an indication of a code conflict. You could run a plugin/theme test by deactivating all plugins except for WooCommerce and switching to the Storefront theme. Then see if you can save your settings.

    Can you update woocommerce_registration_generate_password inside /wp-admin/options.php?

    Thread Starter eddwhomst

    (@eddwhomst)

    Hi @3sonsdevelopment,

    Is it possible to disable all plugins/themes without affecting the main site? In a “staging” env fashion?
    Currently, the option keeps reverting when changed in /wp-admin/options.php

    You can try using the Troubleshooting Mode that is part of the Health Check plugin. It disables plugins/changes themes only for the logged in administrators. You could give that a try. It’s not quite as definitive as running an actual conflict test but can be helpful.

    You could also set up a staging site and test there without disrupting the main site.

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    We’ve not heard back from you in a while so I’ll go ahead and mark this thread as resolved. Hopefully, you were able to find a way forward with the issue.

    Please feel free to create a new thread if you have further questions.

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Create user using the API doesn’t send choose password email’ is closed to new replies.