Support » Plugin: WooCommerce Address Book » Cannot edit standard billing and delivery addresses

  • Resolved Bri

    (@tinnyfusion)


    Hi, firstly thank you for this excellent plugin. This is a much needed feature that in my opinion should have been part of core.

    Anyway, on to the issue I have noticed. When viewing my account I can add, edit or make primary just as described. However, if I try to edit the standard billing or delivery address that was setup before installing this plugin all I see is first name, last name and email address fields..? No address fields at all – then the standard save address button.

    If I set an address from my address book to primary I can edit it just fine and the old address is moved to the address book as you would expect. Then when I set the original address back to the primary one I am able to edit it without issue.

    Two things to note, in my functions.php I do unset the following two fields (which incidentally are shown by your plugin – how would I also go about unsetting these two fields from being used by your plugin as well?):

    unset($fields[‘billing’][‘billing_company’]);
    unset($fields[‘shipping’][‘shipping_company’]);

    Any help with this would very much be appreciated.

    Thanks in advance,

    Bri

    • This topic was modified 3 years, 1 month ago by Bri. Reason: Now resolved
    • This topic was modified 3 years, 1 month ago by t-p.
Viewing 1 replies (of 1 total)
  • Thread Starter Bri

    (@tinnyfusion)

    *EDIT*

    I found the cause. I have a snippet that removes the address fields for FREE products and it seems it was causing the above reported issue. Once I had removed it then your plugin worked correctly.

    This was the code:

    // Remove Billing Fields for Free Virtual Products
    /* ------------------------------------- */
    add_filter( 'woocommerce_billing_fields', 'remove_billing_fields_for_virtual', 20 );
    
    function remove_billing_fields_for_virtual( $fields ) {
    	global $woocommerce;
    	// if the total is more than 0 then we still need the fields
    	if ( 0 != $woocommerce->cart->total ) {
    		return $fields;
    	}
    	// return the regular billing fields if we need shipping fields
    	if ( $woocommerce->cart->needs_shipping() ) {
    		return $fields;
    	}
    	// we don't need the billing fields so empty all of them except the email and customer name
    	// unset( $fields['billing_first_name'] );
    	// unset( $fields['billing_last_name'] );
    	unset( $fields['billing_country'] );
    	unset( $fields['billing_company'] );
    	unset( $fields['billing_address_1'] );
    	unset( $fields['billing_address_2'] );
    	unset( $fields['billing_city'] );
    	unset( $fields['billing_state'] );
    	unset( $fields['billing_postcode'] );
    	unset( $fields['billing_phone'] );
    	return $fields;
    }
    /* ------------------------------------- */

    Shame both won’t work together..

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Cannot edit standard billing and delivery addresses’ is closed to new replies.