Skip to content

Instantly share code, notes, and snippets.

@NickGreen
Last active July 20, 2018 20:17
Show Gist options
  • Save NickGreen/fd9f25d5da8aa8d468cc9ea3cc02433f to your computer and use it in GitHub Desktop.
Save NickGreen/fd9f25d5da8aa8d468cc9ea3cc02433f to your computer and use it in GitHub Desktop.
Display 'Change Address' button even if there are no shipping methods declared
<?php
function always_show_edit_address_subscription_action( $actions, $subscription ) {
if ( $subscription->has_status( array( 'active', 'on-hold' ) ) ) {
$actions['change_address'] = array(
'url' => add_query_arg( array( 'subscription' => $subscription->get_id() ), wc_get_endpoint_url( 'edit-address', 'shipping' ) ),
'name' => __( 'Change Address', 'woocommerce-subscriptions' ),
);
}
return $actions;
}
add_filter( 'wcs_view_subscription_actions', 'always_show_edit_address_subscription_action', 11, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment