Skip to content

Release testing instructions for WC Payments 7.2.0

Dat Hoang edited this page Feb 2, 2024 · 3 revisions

Fix losing cart contents during the login at checkout - PR 8084

Prep:

Add the following snippet to the bottom of woocommerce-payments.php. Or you can use https://wordpress.org/plugins/code-snippets/ and add this snippet. This simulates another plugin making a request, with the session cookies, during login.

function do_api_call_w_cookies_on_wp_login() {
	$url = rest_url();
	
	$args = array(
		'cookies'   => $_COOKIE,
		'blocking'  => false,
		'timeout'   => 0.01,
		'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
	);

	$result = wp_remote_get( $url, $args );
}

add_action( 'wp_login',  'do_api_call_w_cookies_on_wp_login' );

Test 1:

  1. Ensure "Allow customers to log into an existing account during checkout" is enabled at WooCommerce > Settings > Accounts & Privacy
  2. Ensure you're not logged into the store (or use a private browser session)
  3. Add an item to your cart and go to the checkout page
  4. Use the Returning customer? Click here to login option and login
  5. Expectation: the cart is NOT empty.
  6. Expectation: if this user has already had other active products in the cart before log-in, the final cart after log-in should merge these products and the product you've added in.

Test 2:

  1. Enable account creation during checkout in the WooCommerce settings
  2. Without logging in, add a product to cart and go to the checkout page
  3. Fill out the checkout form and use a test card that requires authentication (such as 4000002500003155 or 4000 0027 6000 3184), don't forget to check the account creation checkbox
  4. Submit the order and authorize it
  5. Expectation: The order should be paid successfully.
Clone this wiki locally