• Resolved decarvalhoaa

    (@decarvalhoaa)


    I’m trying to get WooCommerce email settings using the following call:

    $settings = get_option(  'woocommerce_new_order_settings' );
    $settings = get_option(  'woocommerce_customer_processing_order_settings' );
    $settings = get_option(  'woocommerce_customer_refunded_order_settings' );
    $settings = get_option(  'woocommerce_customer_note_settings' );
    $settings = get_option(  'woocommerce_customer_invoice_settings' );
    $settings = get_option(  'woocommerce_customer_completed_order_settings' );
    $settings = get_option(  'woocommerce_customer_new_account_settings' );
    $settings = get_option(  'woocommerce_customer_reset_password_settings' );

    The get_option() function returns false until I go to the andmin backoffice WooCommerce->Settings->Emails tab and for each email type and save the settings (is not required to change anything, just pressing the Save button will do) afterwards the function returns the array of settings.

    Is there anyway to get the settings without forcing the admin user to save all the settings one by one?

    Thanks in advance for your help.
    A

    https://wordpress.org/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    If the settings have not been set/saved, then no, you’d have to define a default. You can pass a default to get_option which is returned if the option does not exist yet.

    Thread Starter decarvalhoaa

    (@decarvalhoaa)

    Got it. Thanks for the quick response.

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

The topic ‘get_option woocommerce email settings returns false’ is closed to new replies.