Merge pull request #24544 from woocommerce/fix/checkout-permalink

Prefer wc_get_checkout_url() instead of wc_get_page_permalink( 'checkout' )
This commit is contained in:
Rodrigo Primo 2019-09-25 20:38:38 -03:00 committed by GitHub
commit 4550bb6661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 19 deletions

View File

@ -216,11 +216,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
if ( $order ) {
$return_url = $order->get_checkout_order_received_url();
} else {
$return_url = wc_get_endpoint_url( 'order-received', '', wc_get_page_permalink( 'checkout' ) );
}
if ( is_ssl() || get_option( 'woocommerce_force_ssl_checkout' ) == 'yes' ) {
$return_url = str_replace( 'http:', 'https:', $return_url );
$return_url = wc_get_endpoint_url( 'order-received', '', wc_get_checkout_url() );
}
return apply_filters( 'woocommerce_get_return_url', $return_url, $order );
@ -524,7 +520,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
esc_attr( $this->id ),
esc_html__( 'Save to account', 'woocommerce' )
);
echo apply_filters( 'woocommerce_payment_gateway_save_new_payment_method_option_html', $html, $this );
}

View File

@ -1510,11 +1510,7 @@ class WC_Order extends WC_Abstract_Order {
* @return string
*/
public function get_checkout_payment_url( $on_checkout = false ) {
$pay_url = wc_get_endpoint_url( 'order-pay', $this->get_id(), wc_get_page_permalink( 'checkout' ) );
if ( 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) || is_ssl() ) {
$pay_url = str_replace( 'http:', 'https:', $pay_url );
}
$pay_url = wc_get_endpoint_url( 'order-pay', $this->get_id(), wc_get_checkout_url() );
if ( $on_checkout ) {
$pay_url = add_query_arg( 'key', $this->get_order_key(), $pay_url );
@ -1537,12 +1533,7 @@ class WC_Order extends WC_Abstract_Order {
* @return string
*/
public function get_checkout_order_received_url() {
$order_received_url = wc_get_endpoint_url( 'order-received', $this->get_id(), wc_get_page_permalink( 'checkout' ) );
if ( 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) || is_ssl() ) {
$order_received_url = str_replace( 'http:', 'https:', $order_received_url );
}
$order_received_url = wc_get_endpoint_url( 'order-received', $this->get_id(), wc_get_checkout_url() );
$order_received_url = add_query_arg( 'key', $this->get_order_key(), $order_received_url );
return apply_filters( 'woocommerce_get_checkout_order_received_url', $order_received_url, $this );

View File

@ -12,7 +12,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.4.0
* @version 3.8.0
*/
defined( 'ABSPATH' ) || exit;
@ -30,7 +30,7 @@ if ( is_user_logged_in() || 'no' === get_option( 'woocommerce_enable_checkout_lo
woocommerce_login_form(
array(
'message' => esc_html__( 'If you have shopped with us before, please enter your details below. If you are a new customer, please proceed to the Billing section.', 'woocommerce' ),
'redirect' => wc_get_page_permalink( 'checkout' ),
'redirect' => wc_get_checkout_url(),
'hidden' => true,
)
);