3 comments

  1. They don’t work anymore, they’re only for Woocommerce 2.1 or less. They have been replaced with endpoints, so you would need to do something like this:

    $my_account_link = get_permalink( get_option('woocommerce_myaccount_page_id') );
    $edit_acount_link = $my_account_link . '/edit-account';
    

    If the first line is too long try with this:

    $my_account_link = get_bloginfo('url'). '/my-account';
    

    You can read more information about endpoints at: https://docs.woothemes.com/document/woocommerce-endpoints-2-1/

  2. You can use instead the native WooCommerce function wc_customer_edit_account_url().
    (It’s used in woocommerce my_account.php template too).

    As Skatox mention it, [woocommerce_edit_account] doesn’t work anymore.

    You can use it with a custom self closing shortcode:

    // Paste this in the function.php file of your active child theme or theme.
    function wc_customer_edit_account_shortcode( $atts ) {
    
        // Attributes
        $atts = shortcode_atts(
            array(
                'text' => '',
            ),
        );
    
        return '<a class="customer-edit-account" href="'.wc_customer_edit_account().'">'.$text.'</a>';
    
    }
    add_shortcode( 'wc_customer_edit_account', 'wc_customer_edit_account_shortcode' );
    

    Use: [wc_customer_edit_account text="Editing my account details" /]

  3. On my site (with WooCommerce 3.6.5) this is the code that worked for me:

    // Paste this in the function.php file of your active child theme or theme.
    function wc_customer_edit_account_shortcode( $atts ) {
    
        // Attributes
        extract( shortcode_atts( array(
                    'text' => 'Edit Account' ), $atts ) );
    
        return '<a class="customer-edit-account" href="'.wc_customer_edit_account_url().'">'.$text.'</a>';
    
    }
    add_shortcode( 'wc_customer_edit_account', 'wc_customer_edit_account_shortcode' );
    

    Instead of editing the function.php or even adding a child theme, I pasted it in a New Snippet using the Snippets plugin.

Comments are closed.