Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter benjamindavis

    (@benjamindavis)

    Thanks for the info, I have tried to bump the existing bug report. We shall see if they decide that a core function that is broken should be corrected.

    I have decided to use the ‘woocommerce_account_menu_items’ hook and rewrite the text so I don’t need to update the files anymore.

    It’s just annoying to have the site waste resource on a line of code that is essentially worthless.

    Having looked into it the translation lookup seems to be the problem.

    In woocommerce/includes/wc-account-functions.php @ line 101:

    'edit-address' => _n( 'Addresses', 'Address', (int) wc_shipping_enabled(), 'woocommerce' ),

    My guess is that because it is used in reverse it’s failing.
    With Shipping Disabled: wc_shipping_enabled() provides a boolean which becomes 0 when converted to (int)
    As that is !=1 it is intended to give text “Address”

    With Shipping Enabled: wc_shipping_enabled() gives bool true converted to int 1
    1 is singular so the text is “Addresses”

    My fix, swap the words so they are correct for the function, ie singular then plural, and add 1 to the result of wc_shipping_enabled() so the new line is
    'edit-address' => _n( 'Address', 'Addresses', (int) wc_shipping_enabled()+1, 'woocommerce' ),

    • This reply was modified 5 years, 2 months ago by benjamindavis.

    I am having the same problem.
    Disable shipping and the Addresses link text gets removed.
    Not a good experience for the user, the only way to update their billing address is via the link on the my-account dashboard.

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