Commit ed0087f56b for woocommerce

commit ed0087f56b9c5b3745ad5b5d434c02783d6e7633
Author: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com>
Date:   Tue Dec 9 14:44:48 2025 +0200

    k6 tests: remove checkout shortcode setup from performance tests (#62336)

    * Remove  cart and checkout shortcode setup from performance tests

    * Use Store API for cart operations and checkout process

diff --git a/plugins/woocommerce/changelog/k6-cleanup-shortcode-setup b/plugins/woocommerce/changelog/k6-cleanup-shortcode-setup
new file mode 100644
index 0000000000..dbf031f31d
--- /dev/null
+++ b/plugins/woocommerce/changelog/k6-cleanup-shortcode-setup
@@ -0,0 +1,5 @@
+Significance: patch
+Type: dev
+Comment: Updated K6 tests setup
+
+
diff --git a/plugins/woocommerce/tests/performance/requests/shopper/cart-remove-item.js b/plugins/woocommerce/tests/performance/requests/shopper/cart-remove-item.js
index 02603eacdc..d531cd7e56 100644
--- a/plugins/woocommerce/tests/performance/requests/shopper/cart-remove-item.js
+++ b/plugins/woocommerce/tests/performance/requests/shopper/cart-remove-item.js
@@ -16,16 +16,18 @@ import { base_url, think_time_min, think_time_max } from '../../config.js';
 import {
 	htmlRequestHeader,
 	jsonRequestHeader,
+	jsonAPIRequestHeader,
 	commonRequestHeaders,
 	commonGetRequestHeaders,
 	commonPostRequestHeaders,
+	commonAPIGetRequestHeaders,
 	commonNonStandardHeaders,
 } from '../../headers.js';
 import { getDefaultProduct } from '../../utils.js';

 export function cartRemoveItem() {
-	let item_to_remove;
-	let wpnonce;
+	let cartItemKey;
+	let storeApiNonce;

 	group( 'Product Page Add to cart', function () {
 		const requestheaders = Object.assign(
@@ -75,32 +77,72 @@ export function cartRemoveItem() {
 				! r.body.includes( 'Your cart is currently empty.' ),
 		} );

-		// Correlate cart item value for use in subsequent requests.
-		item_to_remove = findBetween( response.body, '?remove_item=', '&' );
-		wpnonce = findBetween( response.body, '_wpnonce=', '" class="remove"' );
+		// Extract Store API nonce for cart operations.
+		storeApiNonce = findBetween( response.body, "storeApiNonce: '", "'" );
+		if ( ! storeApiNonce ) {
+			storeApiNonce = findBetween(
+				response.body,
+				'storeApiNonce":"',
+				'"'
+			);
+		}
 	} );

 	sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );

-	group( 'Remove item from cart', function () {
+	group( 'Get cart item key via Store API', function () {
 		const requestheaders = Object.assign(
 			{},
-			jsonRequestHeader,
+			{ Nonce: storeApiNonce },
+			jsonAPIRequestHeader,
+			commonAPIGetRequestHeaders,
+			commonRequestHeaders,
+			commonNonStandardHeaders
+		);
+
+		const response = http.get( `${ base_url }/wp-json/wc/store/v1/cart`, {
+			headers: requestheaders,
+			tags: { name: 'Shopper - Store API Get Cart' },
+		} );
+		check( response, {
+			'is status 200': ( r ) => r.status === 200,
+		} );
+
+		const cartData = response.json();
+		if ( cartData.items && cartData.items.length > 0 ) {
+			cartItemKey = cartData.items[ 0 ].key;
+		}
+	} );
+
+	sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
+
+	group( 'Remove item from cart via Store API', function () {
+		const requestheaders = Object.assign(
+			{},
+			{ 'content-type': 'application/json', Nonce: storeApiNonce },
+			jsonAPIRequestHeader,
 			commonRequestHeaders,
 			commonPostRequestHeaders,
 			commonNonStandardHeaders
 		);

-		const response = http.get(
-			`${ base_url }/cart?remove_item=${ item_to_remove }&_wpnonce=${ wpnonce }`,
+		const response = http.post(
+			`${ base_url }/wp-json/wc/store/v1/cart/remove-item`,
+			JSON.stringify( { key: cartItemKey } ),
 			{
 				headers: requestheaders,
-				tags: { name: 'Shopper - Remove Item From Cart' },
+				tags: { name: 'Shopper - Store API Remove Item From Cart' },
 			}
 		);
 		check( response, {
 			'is status 200': ( r ) => r.status === 200,
-			"body contains: 'removed'": ( r ) => r.body.includes( ' removed.' ),
+			'cart items reduced': ( r ) => {
+				const cart = r.json();
+				return (
+					cart.items &&
+					! cart.items.find( ( item ) => item.key === cartItemKey )
+				);
+			},
 		} );
 	} );

diff --git a/plugins/woocommerce/tests/performance/requests/shopper/checkout-customer-login.js b/plugins/woocommerce/tests/performance/requests/shopper/checkout-customer-login.js
index f4dc42d257..db075abd57 100644
--- a/plugins/woocommerce/tests/performance/requests/shopper/checkout-customer-login.js
+++ b/plugins/woocommerce/tests/performance/requests/shopper/checkout-customer-login.js
@@ -27,12 +27,6 @@ import {
 	addresses_customer_billing_postcode,
 	addresses_customer_billing_phone,
 	addresses_customer_billing_email,
-	addresses_guest_billing_country,
-	addresses_guest_billing_address_1,
-	addresses_guest_billing_address_2,
-	addresses_guest_billing_city,
-	addresses_guest_billing_state,
-	addresses_guest_billing_postcode,
 	payment_method,
 	think_time_min,
 	think_time_max,
@@ -41,7 +35,7 @@ import {
 } from '../../config.js';
 import {
 	htmlRequestHeader,
-	jsonRequestHeader,
+	jsonAPIRequestHeader,
 	allRequestHeader,
 	commonRequestHeaders,
 	commonGetRequestHeaders,
@@ -51,10 +45,8 @@ import {
 import { checkResponse } from '../../utils.js';

 export function checkoutCustomerLogin() {
-	let woocommerce_process_checkout_nonce_customer;
 	let woocommerce_login_nonce;
-	let update_order_review_nonce_guest;
-	let update_order_review_nonce_customer;
+	let storeApiNonce;

 	group( 'Proceed to checkout', function () {
 		const requestHeaders = Object.assign(
@@ -72,57 +64,16 @@ export function checkoutCustomerLogin() {

 		checkResponse( response, 200, {
 			title: `Checkout – ${ STORE_NAME }`,
-			body: 'class="checkout woocommerce-checkout"',
+			body: 'wp-block-woocommerce-checkout',
 			footer: FOOTER_TEXT,
 		} );

-		// Correlate nonce values for use in subsequent requests.
-		woocommerce_login_nonce = response
-			.html()
-			.find( 'input[name=woocommerce-login-nonce]' )
-			.first()
-			.attr( 'value' );
-		update_order_review_nonce_guest = findBetween(
+		// Correlate login nonce for use in subsequent request.
+		woocommerce_login_nonce = findBetween(
 			response.body,
-			'update_order_review_nonce":"',
-			'","apply_coupon_nonce'
+			'name="woocommerce-login-nonce" value="',
+			'"'
 		);
-
-		const requestHeadersPost = Object.assign(
-			{},
-			allRequestHeader,
-			commonRequestHeaders,
-			commonPostRequestHeaders,
-			commonNonStandardHeaders
-		);
-
-		const updateResponse = http.post(
-			`${ base_url }/?wc-ajax=update_order_review`,
-			{
-				security: `${ update_order_review_nonce_guest }`,
-				payment_method: `${ payment_method }`,
-				country: `${ addresses_guest_billing_country }`,
-				state: `${ addresses_guest_billing_state }`,
-				postcode: `${ addresses_guest_billing_postcode }`,
-				city: `${ addresses_guest_billing_city }`,
-				address: `${ addresses_guest_billing_address_1 }`,
-				address_2: `${ addresses_guest_billing_address_2 }`,
-				s_country: `${ addresses_guest_billing_country }`,
-				s_state: `${ addresses_guest_billing_state }`,
-				s_postcode: `${ addresses_guest_billing_postcode }`,
-				s_city: `${ addresses_guest_billing_city }`,
-				s_address: `${ addresses_guest_billing_address_1 }`,
-				s_address_2: `${ addresses_guest_billing_address_2 }`,
-				has_full_address: 'true',
-			},
-			{
-				headers: requestHeadersPost,
-				tags: { name: 'Shopper - wc-ajax=update_order_review' },
-			}
-		);
-		check( updateResponse, {
-			'is status 200': ( r ) => r.status === 200,
-		} );
 	} );

 	sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
@@ -155,94 +106,119 @@ export function checkoutCustomerLogin() {
 			'is status 200': ( r ) => r.status === 200,
 		} );

-		// Correlate nonce values for use in subsequent requests.
-		woocommerce_process_checkout_nonce_customer = response
-			.html()
-			.find( 'input[name=woocommerce-process-checkout-nonce]' )
-			.first()
-			.attr( 'value' );
-		update_order_review_nonce_customer = findBetween(
-			response.body,
-			'update_order_review_nonce":"',
-			'","apply_coupon_nonce'
-		);
+		// Extract Store API nonce from logged-in checkout page.
+		storeApiNonce = findBetween( response.body, "storeApiNonce: '", "'" );
+		if ( ! storeApiNonce ) {
+			storeApiNonce = findBetween(
+				response.body,
+				'storeApiNonce":"',
+				'"'
+			);
+		}
+	} );

-		const requestHeadersPost = Object.assign(
+	sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
+
+	group( 'Update customer billing address via Store API', function () {
+		const requestHeaders = Object.assign(
 			{},
-			allRequestHeader,
+			{ 'content-type': 'application/json', Nonce: storeApiNonce },
+			jsonAPIRequestHeader,
 			commonRequestHeaders,
 			commonPostRequestHeaders,
 			commonNonStandardHeaders
 		);

-		const updateResponse = http.post(
-			`${ base_url }/?wc-ajax=update_order_review`,
-			{
-				security: `${ update_order_review_nonce_customer }`,
-				payment_method: `${ payment_method }`,
-				country: `${ addresses_customer_billing_country }`,
-				state: `${ addresses_customer_billing_state }`,
-				postcode: `${ addresses_customer_billing_postcode }`,
-				city: `${ addresses_customer_billing_city }`,
-				address: `${ addresses_customer_billing_address_1 }`,
-				address_2: `${ addresses_customer_billing_address_2 }`,
-				s_country: `${ addresses_customer_billing_country }`,
-				s_state: `${ addresses_customer_billing_state }`,
-				s_postcode: `${ addresses_customer_billing_postcode }`,
-				s_city: `${ addresses_customer_billing_city }`,
-				s_address: `${ addresses_customer_billing_address_1 }`,
-				s_address_2: `${ addresses_customer_billing_address_2 }`,
-				has_full_address: 'true',
-			},
+		const response = http.post(
+			`${ base_url }/wp-json/wc/store/v1/cart/update-customer`,
+			JSON.stringify( {
+				billing_address: {
+					first_name: addresses_customer_billing_first_name,
+					last_name: addresses_customer_billing_last_name,
+					company: addresses_customer_billing_company,
+					address_1: addresses_customer_billing_address_1,
+					address_2: addresses_customer_billing_address_2,
+					city: addresses_customer_billing_city,
+					state: addresses_customer_billing_state,
+					postcode: addresses_customer_billing_postcode,
+					country: addresses_customer_billing_country,
+					email: addresses_customer_billing_email,
+					phone: addresses_customer_billing_phone,
+				},
+				shipping_address: {
+					first_name: addresses_customer_billing_first_name,
+					last_name: addresses_customer_billing_last_name,
+					company: addresses_customer_billing_company,
+					address_1: addresses_customer_billing_address_1,
+					address_2: addresses_customer_billing_address_2,
+					city: addresses_customer_billing_city,
+					state: addresses_customer_billing_state,
+					postcode: addresses_customer_billing_postcode,
+					country: addresses_customer_billing_country,
+				},
+			} ),
 			{
-				headers: requestHeadersPost,
-				tags: { name: 'Shopper - wc-ajax=update_order_review' },
+				headers: requestHeaders,
+				tags: { name: 'Shopper - Store API update-customer' },
 			}
 		);
-		check( updateResponse, {
+		check( response, {
 			'is status 200': ( r ) => r.status === 200,
 		} );
 	} );

 	sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );

-	group( 'Place Order', function () {
+	group( 'Place Order via Store API', function () {
 		const requestHeaders = Object.assign(
 			{},
-			jsonRequestHeader,
+			{ 'content-type': 'application/json', Nonce: storeApiNonce },
+			jsonAPIRequestHeader,
 			commonRequestHeaders,
 			commonPostRequestHeaders,
 			commonNonStandardHeaders
 		);

 		const response = http.post(
-			`${ base_url }/?wc-ajax=checkout`,
-			{
-				billing_first_name: `${ addresses_customer_billing_first_name }`,
-				billing_last_name: `${ addresses_customer_billing_last_name }`,
-				billing_company: `${ addresses_customer_billing_company }`,
-				billing_country: `${ addresses_customer_billing_country }`,
-				billing_address_1: `${ addresses_customer_billing_address_1 }`,
-				billing_address_2: `${ addresses_customer_billing_address_2 }`,
-				billing_city: `${ addresses_customer_billing_city }`,
-				billing_state: `${ addresses_customer_billing_state }`,
-				billing_postcode: `${ addresses_customer_billing_postcode }`,
-				billing_phone: `${ addresses_customer_billing_phone }`,
-				billing_email: `${ addresses_customer_billing_email }`,
-				order_comments: '',
-				payment_method: `${ payment_method }`,
-				'woocommerce-process-checkout-nonce': `${ woocommerce_process_checkout_nonce_customer }`,
-				_wp_http_referer: '%2F%3Fwc-ajax%3Dupdate_order_review',
-			},
+			`${ base_url }/wp-json/wc/store/v1/checkout`,
+			JSON.stringify( {
+				billing_address: {
+					first_name: addresses_customer_billing_first_name,
+					last_name: addresses_customer_billing_last_name,
+					company: addresses_customer_billing_company,
+					address_1: addresses_customer_billing_address_1,
+					address_2: addresses_customer_billing_address_2,
+					city: addresses_customer_billing_city,
+					state: addresses_customer_billing_state,
+					postcode: addresses_customer_billing_postcode,
+					country: addresses_customer_billing_country,
+					email: addresses_customer_billing_email,
+					phone: addresses_customer_billing_phone,
+				},
+				shipping_address: {
+					first_name: addresses_customer_billing_first_name,
+					last_name: addresses_customer_billing_last_name,
+					company: addresses_customer_billing_company,
+					address_1: addresses_customer_billing_address_1,
+					address_2: addresses_customer_billing_address_2,
+					city: addresses_customer_billing_city,
+					state: addresses_customer_billing_state,
+					postcode: addresses_customer_billing_postcode,
+					country: addresses_customer_billing_country,
+				},
+				payment_method,
+			} ),
 			{
 				headers: requestHeaders,
-				tags: { name: 'Shopper - wc-ajax=checkout' },
+				tags: { name: 'Shopper - Store API checkout' },
 			}
 		);
 		check( response, {
 			'is status 200': ( r ) => r.status === 200,
-			'body contains: order-received': ( r ) =>
-				r.body.includes( 'order-received' ),
+			'body contains: order_id': ( r ) => {
+				const data = r.json();
+				return data && data.order_id > 0;
+			},
 		} );
 	} );

diff --git a/plugins/woocommerce/tests/performance/requests/shopper/checkout-guest.js b/plugins/woocommerce/tests/performance/requests/shopper/checkout-guest.js
index a5f2e09b20..8a6d7272b8 100644
--- a/plugins/woocommerce/tests/performance/requests/shopper/checkout-guest.js
+++ b/plugins/woocommerce/tests/performance/requests/shopper/checkout-guest.js
@@ -33,7 +33,7 @@ import {
 } from '../../config.js';
 import {
 	htmlRequestHeader,
-	jsonRequestHeader,
+	jsonAPIRequestHeader,
 	allRequestHeader,
 	commonRequestHeaders,
 	commonGetRequestHeaders,
@@ -43,8 +43,7 @@ import {
 import { checkResponse } from '../../utils.js';

 export function checkoutGuest() {
-	let woocommerce_process_checkout_nonce_guest;
-	let update_order_review_nonce_guest;
+	let storeApiNonce;

 	group( 'Proceed to checkout', function () {
 		const requestHeaders = Object.assign(
@@ -61,98 +60,123 @@ export function checkoutGuest() {
 		} );
 		checkResponse( response, 200, {
 			title: `Checkout – ${ STORE_NAME }`,
-			body: 'class="checkout woocommerce-checkout"',
+			body: 'wp-block-woocommerce-checkout',
 			footer: FOOTER_TEXT,
 		} );

-		// Correlate nonce values for use in subsequent requests.
-		woocommerce_process_checkout_nonce_guest = response
-			.html()
-			.find( 'input[name=woocommerce-process-checkout-nonce]' )
-			.first()
-			.attr( 'value' );
-		update_order_review_nonce_guest = findBetween(
-			response.body,
-			'update_order_review_nonce":"',
-			'","apply_coupon_nonce'
-		);
+		// Extract Store API nonce for checkout request.
+		storeApiNonce = findBetween( response.body, "storeApiNonce: '", "'" );
+		if ( ! storeApiNonce ) {
+			storeApiNonce = findBetween(
+				response.body,
+				'storeApiNonce":"',
+				'"'
+			);
+		}
+	} );

-		const requestHeadersPost = Object.assign(
+	sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );
+
+	group( 'Update customer billing address via Store API', function () {
+		const requestHeaders = Object.assign(
 			{},
-			allRequestHeader,
+			{ 'content-type': 'application/json', Nonce: storeApiNonce },
+			jsonAPIRequestHeader,
 			commonRequestHeaders,
 			commonPostRequestHeaders,
 			commonNonStandardHeaders
 		);

-		const updateResponse = http.post(
-			`${ base_url }/?wc-ajax=update_order_review`,
-			{
-				security: `${ update_order_review_nonce_guest }`,
-				payment_method: `${ payment_method }`,
-				country: `${ addresses_guest_billing_country }`,
-				state: `${ addresses_guest_billing_state }`,
-				postcode: `${ addresses_guest_billing_postcode }`,
-				city: `${ addresses_guest_billing_city }`,
-				address: `${ addresses_guest_billing_address_1 }`,
-				address_2: `${ addresses_guest_billing_address_2 }`,
-				s_country: `${ addresses_guest_billing_country }`,
-				s_state: `${ addresses_guest_billing_state }`,
-				s_postcode: `${ addresses_guest_billing_postcode }`,
-				s_city: `${ addresses_guest_billing_city }`,
-				s_address: `${ addresses_guest_billing_address_1 }`,
-				s_address_2: `${ addresses_guest_billing_address_2 }`,
-				has_full_address: 'true',
-			},
+		const response = http.post(
+			`${ base_url }/wp-json/wc/store/v1/cart/update-customer`,
+			JSON.stringify( {
+				billing_address: {
+					first_name: addresses_guest_billing_first_name,
+					last_name: addresses_guest_billing_last_name,
+					company: addresses_guest_billing_company,
+					address_1: addresses_guest_billing_address_1,
+					address_2: addresses_guest_billing_address_2,
+					city: addresses_guest_billing_city,
+					state: addresses_guest_billing_state,
+					postcode: addresses_guest_billing_postcode,
+					country: addresses_guest_billing_country,
+					email: addresses_guest_billing_email,
+					phone: addresses_guest_billing_phone,
+				},
+				shipping_address: {
+					first_name: addresses_guest_billing_first_name,
+					last_name: addresses_guest_billing_last_name,
+					company: addresses_guest_billing_company,
+					address_1: addresses_guest_billing_address_1,
+					address_2: addresses_guest_billing_address_2,
+					city: addresses_guest_billing_city,
+					state: addresses_guest_billing_state,
+					postcode: addresses_guest_billing_postcode,
+					country: addresses_guest_billing_country,
+				},
+			} ),
 			{
-				headers: requestHeadersPost,
-				tags: { name: 'Shopper - wc-ajax=update_order_review' },
+				headers: requestHeaders,
+				tags: { name: 'Shopper - Store API update-customer' },
 			}
 		);
-		check( updateResponse, {
+		check( response, {
 			'is status 200': ( r ) => r.status === 200,
 		} );
 	} );

 	sleep( randomIntBetween( `${ think_time_min }`, `${ think_time_max }` ) );

-	group( 'Place Order', function () {
+	group( 'Place Order via Store API', function () {
 		const requestHeaders = Object.assign(
 			{},
-			jsonRequestHeader,
+			{ 'content-type': 'application/json', Nonce: storeApiNonce },
+			jsonAPIRequestHeader,
 			commonRequestHeaders,
 			commonPostRequestHeaders,
 			commonNonStandardHeaders
 		);

 		const response = http.post(
-			`${ base_url }/?wc-ajax=checkout`,
-			{
-				billing_first_name: `${ addresses_guest_billing_first_name }`,
-				billing_last_name: `${ addresses_guest_billing_last_name }`,
-				billing_company: `${ addresses_guest_billing_company }`,
-				billing_country: `${ addresses_guest_billing_country }`,
-				billing_address_1: `${ addresses_guest_billing_address_1 }`,
-				billing_address_2: `${ addresses_guest_billing_address_2 }`,
-				billing_city: `${ addresses_guest_billing_city }`,
-				billing_state: `${ addresses_guest_billing_state }`,
-				billing_postcode: `${ addresses_guest_billing_postcode }`,
-				billing_phone: `${ addresses_guest_billing_phone }`,
-				billing_email: `${ addresses_guest_billing_email }`,
-				order_comments: '',
-				payment_method: `${ payment_method }`,
-				'woocommerce-process-checkout-nonce': `${ woocommerce_process_checkout_nonce_guest }`,
-				_wp_http_referer: '%2F%3Fwc-ajax%3Dupdate_order_review',
-			},
+			`${ base_url }/wp-json/wc/store/v1/checkout`,
+			JSON.stringify( {
+				billing_address: {
+					first_name: addresses_guest_billing_first_name,
+					last_name: addresses_guest_billing_last_name,
+					company: addresses_guest_billing_company,
+					address_1: addresses_guest_billing_address_1,
+					address_2: addresses_guest_billing_address_2,
+					city: addresses_guest_billing_city,
+					state: addresses_guest_billing_state,
+					postcode: addresses_guest_billing_postcode,
+					country: addresses_guest_billing_country,
+					email: addresses_guest_billing_email,
+					phone: addresses_guest_billing_phone,
+				},
+				shipping_address: {
+					first_name: addresses_guest_billing_first_name,
+					last_name: addresses_guest_billing_last_name,
+					company: addresses_guest_billing_company,
+					address_1: addresses_guest_billing_address_1,
+					address_2: addresses_guest_billing_address_2,
+					city: addresses_guest_billing_city,
+					state: addresses_guest_billing_state,
+					postcode: addresses_guest_billing_postcode,
+					country: addresses_guest_billing_country,
+				},
+				payment_method,
+			} ),
 			{
 				headers: requestHeaders,
-				tags: { name: 'Shopper - wc-ajax=checkout' },
+				tags: { name: 'Shopper - Store API checkout' },
 			}
 		);
 		check( response, {
 			'is status 200': ( r ) => r.status === 200,
-			'body contains: order-received': ( r ) =>
-				r.body.includes( 'order-received' ),
+			'body contains: order_id': ( r ) => {
+				const data = r.json();
+				return data && data.order_id > 0;
+			},
 		} );
 	} );

diff --git a/plugins/woocommerce/tests/performance/setup/cart-checkout-shortcode.js b/plugins/woocommerce/tests/performance/setup/cart-checkout-shortcode.js
deleted file mode 100644
index 77f6165536..0000000000
--- a/plugins/woocommerce/tests/performance/setup/cart-checkout-shortcode.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/* eslint-disable jsdoc/require-property-description */
-/* eslint-disable @woocommerce/dependency-group */
-/* eslint-disable import/no-unresolved */
-/**
- * k6 dependencies
- */
-import encoding from 'k6/encoding';
-import http from 'k6/http';
-import { check } from 'k6';
-
-/**
- * Internal dependencies
- */
-import { base_url, admin_username, admin_password } from '../config.js';
-
-/**
- * Convert Cart & Checkout pages to shortcode.
- */
-export function setCartCheckoutShortcodes() {
-	/**
-	 * A WordPress page.
-	 *
-	 * @typedef {Object} WPPage
-	 * @property {number} id
-	 * @property {string} slug
-	 */
-
-	let defaultHeaders;
-
-	/**
-	 * @type {WPPage[]}
-	 */
-	let wp_pages;
-
-	/**
-	 * @type {WPPage}
-	 */
-	let cart;
-
-	/**
-	 * @type {WPPage}
-	 */
-	let checkout;
-
-	function setDefaultHeaders() {
-		const credentials = `${ admin_username }:${ admin_password }`;
-		const encodedCredentials = encoding.b64encode( credentials );
-		defaultHeaders = {
-			Authorization: `Basic ${ encodedCredentials }`,
-			'Content-Type': 'application/json',
-		};
-	}
-
-	function listWPPages() {
-		const url = `${ base_url }/wp-json/wp/v2/pages`;
-		const body = {
-			_fields: [ 'id', 'slug' ],
-			context: 'edit',
-		};
-		const params = {
-			headers: defaultHeaders,
-		};
-		const response = http.get( url, body, params );
-		check( response, {
-			'WP pages list obtained': ( r ) => r.status === 200,
-		} );
-		wp_pages = response.json();
-	}
-
-	function findCartCheckoutPage() {
-		cart = wp_pages.find( ( page ) => page.slug === 'cart' );
-		checkout = wp_pages.find( ( page ) => page.slug === 'checkout' );
-	}
-
-	function convertToCartCheckoutShortcode() {
-		const url_cart = `${ base_url }/wp-json/wp/v2/pages/${ cart.id }`;
-		const url_checkout = `${ base_url }/wp-json/wp/v2/pages/${ checkout.id }`;
-
-		const body_cart = {
-			content: {
-				raw: '<!-- wp:shortcode -->[woocommerce_cart]<!-- /wp:shortcode -->',
-			},
-		};
-		const body_checkout = {
-			content: {
-				raw: '<!-- wp:shortcode -->[woocommerce_checkout]<!-- /wp:shortcode -->',
-			},
-		};
-
-		const body_cart_str = JSON.stringify( body_cart );
-		const body_checkout_str = JSON.stringify( body_checkout );
-
-		const params = {
-			headers: defaultHeaders,
-		};
-
-		const response_cart = http.post( url_cart, body_cart_str, params );
-		const response_checkout = http.post(
-			url_checkout,
-			body_checkout_str,
-			params
-		);
-
-		check( response_cart, {
-			'cart shortcode set': ( r ) => r.status >= 200 && r.status < 300,
-		} );
-		check( response_checkout, {
-			'checkout shortcode set': ( r ) =>
-				r.status >= 200 && r.status < 300,
-		} );
-	}
-
-	setDefaultHeaders();
-
-	listWPPages();
-
-	findCartCheckoutPage();
-
-	convertToCartCheckoutShortcode();
-}
diff --git a/plugins/woocommerce/tests/performance/tests/main.js b/plugins/woocommerce/tests/performance/tests/main.js
index e84a0b0895..e10813041a 100644
--- a/plugins/woocommerce/tests/performance/tests/main.js
+++ b/plugins/woocommerce/tests/performance/tests/main.js
@@ -22,7 +22,6 @@ import { ordersFilter } from '../requests/merchant/orders-filter.js';
 import { addOrder } from '../requests/merchant/add-order.js';
 import { ordersAPI } from '../requests/api/orders.js';
 import { homeWCAdmin } from '../requests/merchant/home-wc-admin.js';
-import { setCartCheckoutShortcodes } from '../setup/cart-checkout-shortcode.js';
 import { addCustomerOrder } from '../setup/add-customer-order.js';

 const defaultIterations = 3;
@@ -92,7 +91,6 @@ export const options = {
 };

 export function setup() {
-	setCartCheckoutShortcodes();
 	addCustomerOrder();
 }