Currently it is not possible to do that.
If you are looking to implement it then starting at the add_additional_address_button function and adding some kind of check for if the button should be shown or not.
Add something like this in add_additional_address_button function (class-wc-address-book.php – line 234):
<?php if ( 'billing' === $type && apply_filters( 'show_billing_address_button', true ) ) : ?>
<div class="add-new-address">
<a href="<?php echo esc_url( $this->get_address_book_endpoint_url( $name, 'billing' ) ); ?>" class="add button"><?php echo esc_html_e( 'Add New Billing Address', 'woo-address-book' ); ?></a>
</div>
<?php endif; ?>
<?php if ( 'shipping' === $type && apply_filters( 'show_shipping_address_button', true ) ) : ?>
<div class="add-new-address">
<a href="<?php echo esc_url( $this->get_address_book_endpoint_url( $name, 'shipping' ) ); ?>" class="add button"><?php echo esc_html_e( 'Add New Shipping Address', 'woo-address-book' ); ?></a>
</div>
<?php endif; ?>
We can override it with a simple code like this:
add_filter( 'show_shipping_address_button', '__return_false' );
Example to limit to 3 shipping address:
function show_address_button() {
$wc_address_book = WC_Address_Book::get_instance();
$shipping_address = $wc_address_book->get_address_book( get_current_user_id(), 'shipping' );
if ( count( $shipping_address ) >= 3 ) {
add_filter( 'show_shipping_address_button', '__return_false' );
}
}
add_action( 'woocommerce_account_edit-address_endpoint', 'show_address_button' );
Tested and working!
Best regards.
Thanks for this @artprojectgroup those filters can be useful for many things with the add buttons.
We have added the filters and released 2.1.0
Instead of the exact names that you used, we used the names wc_address_book_show_billing_address_button and wc_address_book_show_shipping_address_button for them.