Make wc_get_endpoint_url() compatible with WordPress use_trailing_slashes settings

This commit is contained in:
Claudio Sanches 2019-07-31 20:57:55 -03:00
parent d627a4bbb8
commit c4afd53749
1 changed files with 4 additions and 2 deletions

View File

@ -101,10 +101,12 @@ function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
} else {
$query_string = '';
}
$url = trailingslashit( $permalink ) . trailingslashit( $endpoint );
$url = trailingslashit( $permalink );
if ( $value ) {
$url .= trailingslashit( $value );
$url .= trailingslashit( $endpoint ) . user_trailingslashit( $value );
} else {
$url .= user_trailingslashit( $endpoint );
}
$url .= $query_string;