diff --git a/plugins/woocommerce-admin/client/layout/controller.js b/plugins/woocommerce-admin/client/layout/controller.js
index dbaa9cb65da..5b35afe55fa 100644
--- a/plugins/woocommerce-admin/client/layout/controller.js
+++ b/plugins/woocommerce-admin/client/layout/controller.js
@@ -68,12 +68,6 @@ const WCPaymentsWelcomePage = lazy( () =>
)
);
-const WCPaymentsSubscriptionsPage = lazy( () =>
- import(
- /* webpackChunkName: "wc-pay-subscriptions-page" */ '../subscriptions'
- )
-);
-
export const PAGES_FILTER = 'woocommerce_admin_pages_list';
export const getPages = () => {
@@ -263,22 +257,6 @@ export const getPages = () => {
} );
}
- if ( window.wcAdminFeatures[ 'wc-pay-subscriptions-page' ] ) {
- pages.push( {
- container: WCPaymentsSubscriptionsPage,
- path: '/subscriptions',
- breadcrumbs: [
- ...initialBreadcrumbs,
- __( 'Subscriptions', 'woocommerce' ),
- ],
- wpOpenMenu: 'toplevel_page_woocommerce',
- navArgs: {
- id: 'woocommerce-wcpay-subscriptions',
- },
- capability: 'manage_woocommerce',
- } );
- }
-
/**
* List of WooCommerce Admin pages.
*
diff --git a/plugins/woocommerce-admin/client/subscriptions/cards/amex.js b/plugins/woocommerce-admin/client/subscriptions/cards/amex.js
deleted file mode 100644
index 1ebef0bdda9..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/cards/amex.js
+++ /dev/null
@@ -1,27 +0,0 @@
-export default () => (
- /* eslint-disable */
-
- /* eslint-enable */
-);
diff --git a/plugins/woocommerce-admin/client/subscriptions/cards/diners.js b/plugins/woocommerce-admin/client/subscriptions/cards/diners.js
deleted file mode 100644
index 6a7e03f4208..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/cards/diners.js
+++ /dev/null
@@ -1,255 +0,0 @@
-export default () => (
- /* eslint-disable */
-
- /* eslint-enable */
-);
diff --git a/plugins/woocommerce-admin/client/subscriptions/cards/discover.js b/plugins/woocommerce-admin/client/subscriptions/cards/discover.js
deleted file mode 100644
index 42439da3e86..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/cards/discover.js
+++ /dev/null
@@ -1,47 +0,0 @@
-export default () => (
- /* eslint-disable */
-
- /* eslint-enable */
-);
diff --git a/plugins/woocommerce-admin/client/subscriptions/cards/jcb.js b/plugins/woocommerce-admin/client/subscriptions/cards/jcb.js
deleted file mode 100644
index aac8d382666..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/cards/jcb.js
+++ /dev/null
@@ -1,39 +0,0 @@
-export default () => (
- /* eslint-disable */
-
- /* eslint-enable */
-);
diff --git a/plugins/woocommerce-admin/client/subscriptions/cards/mastercard.js b/plugins/woocommerce-admin/client/subscriptions/cards/mastercard.js
deleted file mode 100644
index 6830585f03b..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/cards/mastercard.js
+++ /dev/null
@@ -1,39 +0,0 @@
-export default () => (
- /* eslint-disable */
-
- /* eslint-enable */
-);
diff --git a/plugins/woocommerce-admin/client/subscriptions/cards/unionpay.js b/plugins/woocommerce-admin/client/subscriptions/cards/unionpay.js
deleted file mode 100644
index 3f364be6948..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/cards/unionpay.js
+++ /dev/null
@@ -1,111 +0,0 @@
-export default () => (
- /* eslint-disable */
-
- /* eslint-enable */
-);
diff --git a/plugins/woocommerce-admin/client/subscriptions/cards/visa.js b/plugins/woocommerce-admin/client/subscriptions/cards/visa.js
deleted file mode 100644
index 2634d362b8a..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/cards/visa.js
+++ /dev/null
@@ -1,41 +0,0 @@
-export default () => (
- /* eslint-disable */
-
- /* eslint-enable */
-);
diff --git a/plugins/woocommerce-admin/client/subscriptions/index.tsx b/plugins/woocommerce-admin/client/subscriptions/index.tsx
deleted file mode 100644
index 0fca3fe4634..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/index.tsx
+++ /dev/null
@@ -1,343 +0,0 @@
-/**
- * External dependencies
- */
-import { __ } from '@wordpress/i18n';
-import {
- createInterpolateElement,
- useEffect,
- useState,
-} from '@wordpress/element';
-import { Button, Card, CardBody, Notice } from '@wordpress/components';
-import { PLUGINS_STORE_NAME, OPTIONS_STORE_NAME } from '@woocommerce/data';
-import { useDispatch } from '@wordpress/data';
-import { recordEvent } from '@woocommerce/tracks';
-
-/**
- * Internal dependencies
- */
-import Visa from './cards/visa.js';
-import MasterCard from './cards/mastercard.js';
-import Amex from './cards/amex.js';
-import DinersClub from './cards/diners.js';
-import Discover from './cards/discover.js';
-import JCB from './cards/jcb.js';
-import UnionPay from './cards/unionpay.js';
-import './style.scss';
-
-/**
- * The available experiment treatments.
- */
-enum Treatment {
- /**
- * Treatment A: Create a subscription product then WCPay onboarding.
- */
- A = 'A',
-
- /**
- * Treatment B: WCPay onboarding then create a subscription product.
- */
- B = 'B',
-}
-
-declare global {
- interface Window {
- wcWcpaySubscriptions: {
- newSubscriptionProductUrl: string;
- onboardingUrl: string;
- noThanksUrl: string;
- dismissOptionKey: string;
- experimentAssignment: Treatment;
- };
- }
-}
-
-const {
- newSubscriptionProductUrl,
- onboardingUrl,
- noThanksUrl,
- dismissOptionKey,
- experimentAssignment,
-} = window.wcWcpaySubscriptions;
-
-type setHasErrorFunction = React.Dispatch< React.SetStateAction< boolean > >;
-
-const ErrorNotice = () => {
- return (
-
- { createInterpolateElement(
- __(
- 'Installing WooCommerce Payments failed. To continue with WooCommerce Payments built-in subscriptions functionality, please install WooCommerce Payments manually.',
- 'woocommerce'
- ),
- {
- a: (
- // eslint-disable-next-line jsx-a11y/anchor-has-content
-
- ),
- }
- ) }
-
- );
-};
-
-const NoThanksButton = () => {
- const [ isNoThanksClicked, setIsNoThanksClicked ] = useState( false );
- const { updateOptions } = useDispatch( OPTIONS_STORE_NAME );
-
- return (
-
- );
-};
-
-type GetStartedButtonProps = {
- setHasError: setHasErrorFunction;
-};
-
-const GetStartedButton: React.FC< GetStartedButtonProps > = ( {
- setHasError,
-} ) => {
- const [ isGettingStarted, setIsGettingStarted ] = useState( false );
- const { installAndActivatePlugins } = useDispatch( PLUGINS_STORE_NAME );
-
- return (
-
- );
-};
-
-const StepNumber: React.FC = ( { children } ) => (
-
- { children }
-
-);
-
-const TermsOfService = () => (
-
- { createInterpolateElement(
- __(
- 'By clicking “Get started”, the WooCommerce Payments plugin will be installed and you agree to the Terms of Service',
- 'woocommerce'
- ),
- {
- a: (
- // eslint-disable-next-line jsx-a11y/anchor-has-content
-
- ),
- }
- ) }
-
-);
-
-type MainContentProps = {
- setHasError: setHasErrorFunction;
-};
-
-const MainContent: React.FC< MainContentProps > = ( { setHasError } ) => {
- return (
- <>
-
- { __( 'Start selling subscriptions today', 'woocommerce' ) }
-
-
- { __(
- 'With WooCommerce Payments, you can sell subscriptions with no setup costs or monthly fees. Create subscription products, track recurring revenue, and manage subscribers directly from your store’s dashboard.',
- 'woocommerce'
- ) }
-
-
- { __( 'Learn more', 'woocommerce' ) }
-
-
-
- { __( 'Accepted payment methods', 'woocommerce' ) }
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- );
-};
-
-const OnboardingSteps = () => (
- <>
-
- { __(
- 'You’re only steps away from selling subscriptions',
- 'woocommerce'
- ) }
-
-
-
-
1
-
- { experimentAssignment === Treatment.A
- ? __( 'Create a subscription', 'woocommerce' )
- : __(
- 'Create and connect your account',
- 'woocommerce'
- ) }
-
-
- { experimentAssignment === Treatment.A
- ? __(
- 'Add a name, price and image to your subscription product and then publish it.',
- 'woocommerce'
- )
- : __(
- 'To ensure safe and secure transactions, a WordPress.com account is required.',
- 'woocommerce'
- ) }
-
-
-
-
2
-
- { experimentAssignment === Treatment.A
- ? __( 'Create and connect your account', 'woocommerce' )
- : __(
- 'Provide a few business details',
- 'woocommerce'
- ) }
-
-
- { experimentAssignment === Treatment.A
- ? __(
- 'To ensure safe and secure transactions, a WordPress.com account is required.',
- 'woocommerce'
- )
- : __(
- 'Next we’ll ask you to verify your business and payment details to enable deposits.',
- 'woocommerce'
- ) }
-
-
-
-
3
-
- { experimentAssignment === Treatment.A
- ? __( 'Provide a few business details', 'woocommerce' )
- : __( 'Create subscriptions', 'woocommerce' ) }
-
-
- { experimentAssignment === Treatment.A
- ? __(
- 'Finally, we’ll ask you to verify your business and payment details to enable deposits.',
- 'woocommerce'
- )
- : __(
- 'Finally, publish subscription products to offer on your store.',
- 'woocommerce'
- ) }
-
-
-
- >
-);
-
-const SubscriptionsPage = () => {
- const [ hasError, setHasError ] = useState( false );
-
- useEffect( () => {
- recordEvent( 'wccore_subscriptions_empty_state_view' );
- }, [] );
-
- return (
- <>
- { hasError && }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- );
-};
-
-export default SubscriptionsPage;
diff --git a/plugins/woocommerce-admin/client/subscriptions/style.scss b/plugins/woocommerce-admin/client/subscriptions/style.scss
deleted file mode 100644
index d913fdb51e7..00000000000
--- a/plugins/woocommerce-admin/client/subscriptions/style.scss
+++ /dev/null
@@ -1,115 +0,0 @@
-$max-width: 680px;
-
-.wcpay-empty-subscriptions__error {
- margin: 0 auto 24px;
- max-width: $max-width;
-}
-
-.subscriptions-page {
- margin: 0 auto;
- max-width: $max-width;
-
- .components-card {
- margin-bottom: 24px;
- }
-
- .wcpay-empty-subscriptions-page__payment-methods {
- svg {
- display: inline-block;
- height: 35px;
- width: 52px;
- margin-right: 0.5em;
- margin-bottom: 0.5em;
- }
- }
-
- .wcpay-empty-subscriptions-page__terms-of-service {
- display: block;
- margin: 0.5em 0;
- }
-
- .subscriptions-page__onboarding-steps {
- @include breakpoint( '>600px' ) {
- display: flex;
- flex-direction: row;
- }
-
- .subscriptions-page__onboarding-steps--item {
- margin-top: 30px;
-
- @include breakpoint( '>600px' ) {
- margin-top: 0;
- margin-right: 80px;
- }
- }
- }
-
- .wcpay-empty-subscriptions-page__step-number {
- background-color: $studio-woocommerce-purple-50;
- color: $white;
- font-size: 20px;
- border-radius: 50%;
- min-height: 32px;
- min-width: 32px;
- display: inline-block;
- text-align: center;
- line-height: 32px;
- }
-
- .subscriptions {
- h2 {
- font-size: 20px;
- font-weight: 400;
- margin-top: 0;
- }
-
- h3 {
- font-size: 1em;
- }
-
- p {
- color: #3c434a;
- }
-
- .subscriptions__card {
- .components-card__body {
- padding: 0;
-
- .content {
- padding: 24px;
-
- a {
- text-decoration: none;
- }
-
- hr {
- position: relative;
- left: -24px;
- width: calc(100% + 48px);
- }
- }
- }
- }
-
- .subscriptions__action {
- margin-top: 16px;
- margin-bottom: 0;
- }
-
- .subscriptions__steps {
- .components-card__body {
- padding: 24px;
- }
-
- h2 {
- margin-top: 0;
- }
- }
- }
-
- .wcpay-empty-subscriptions__button_container {
- button:not(:first-child) {
- margin-left: 10px;
- }
- }
-}
diff --git a/plugins/woocommerce-admin/client/typings/global.d.ts b/plugins/woocommerce-admin/client/typings/global.d.ts
index b0364548716..1dfcb7588a9 100644
--- a/plugins/woocommerce-admin/client/typings/global.d.ts
+++ b/plugins/woocommerce-admin/client/typings/global.d.ts
@@ -28,7 +28,6 @@ declare global {
'transient-notices': boolean;
'wc-pay-promotion': boolean;
'wc-pay-welcome-page': boolean;
- 'wc-pay-subscriptions-page': boolean;
'shipping-smart-defaults': boolean;
'shipping-setting-tour': boolean;
};
diff --git a/plugins/woocommerce/changelog/remove-34275-wcpay-subscriptions-offer-page-experiment-code b/plugins/woocommerce/changelog/remove-34275-wcpay-subscriptions-offer-page-experiment-code
new file mode 100644
index 00000000000..ad4aaf91795
--- /dev/null
+++ b/plugins/woocommerce/changelog/remove-34275-wcpay-subscriptions-offer-page-experiment-code
@@ -0,0 +1,4 @@
+Significance: minor
+Type: update
+
+Remove WCPay Subscriptions offer page experiment code
diff --git a/plugins/woocommerce/client/admin/config/core.json b/plugins/woocommerce/client/admin/config/core.json
index 19607a3cf27..b9106e08d8b 100644
--- a/plugins/woocommerce/client/admin/config/core.json
+++ b/plugins/woocommerce/client/admin/config/core.json
@@ -27,7 +27,6 @@
"store-alerts": true,
"transient-notices": true,
"wc-pay-promotion": true,
- "wc-pay-welcome-page": true,
- "wc-pay-subscriptions-page": true
+ "wc-pay-welcome-page": true
}
}
diff --git a/plugins/woocommerce/client/admin/config/development.json b/plugins/woocommerce/client/admin/config/development.json
index 24c45013123..29f799f5b04 100644
--- a/plugins/woocommerce/client/admin/config/development.json
+++ b/plugins/woocommerce/client/admin/config/development.json
@@ -27,7 +27,6 @@
"store-alerts": true,
"transient-notices": true,
"wc-pay-promotion": true,
- "wc-pay-welcome-page": true,
- "wc-pay-subscriptions-page": true
+ "wc-pay-welcome-page": true
}
}
diff --git a/plugins/woocommerce/src/Admin/Features/Features.php b/plugins/woocommerce/src/Admin/Features/Features.php
index 5a8935bd6dd..826604176fa 100644
--- a/plugins/woocommerce/src/Admin/Features/Features.php
+++ b/plugins/woocommerce/src/Admin/Features/Features.php
@@ -417,7 +417,6 @@ class Features {
'Automattic\WooCommerce\Internal\Admin\ShippingLabelBanner' => 'Automattic\WooCommerce\Admin\Features\ShippingLabelBanner',
'Automattic\WooCommerce\Internal\Admin\ShippingLabelBannerDisplayRules' => 'Automattic\WooCommerce\Admin\Features\ShippingLabelBannerDisplayRules',
'Automattic\WooCommerce\Internal\Admin\WcPayWelcomePage' => 'Automattic\WooCommerce\Admin\Features\WcPayWelcomePage',
- 'Automattic\WooCommerce\Internal\Admin\WcPaySubscriptionsPage' => 'Automattic\WooCommerce\Admin\Features\WcPaySubscriptionsPage',
);
foreach ( $aliases as $new_class => $orig_class ) {
class_alias( $new_class, $orig_class );
diff --git a/plugins/woocommerce/src/Internal/Admin/WcPaySubscriptionsPage.php b/plugins/woocommerce/src/Internal/Admin/WcPaySubscriptionsPage.php
deleted file mode 100644
index e0a1012e2a9..00000000000
--- a/plugins/woocommerce/src/Internal/Admin/WcPaySubscriptionsPage.php
+++ /dev/null
@@ -1,275 +0,0 @@
- Subscriptions menu item slug.
- *
- * @var string
- */
- const SUBSCRIPTION_MENU_ITEM_SLUG = 'wc-admin&path=/subscriptions';
-
- /**
- * Hook into WooCommerce.
- */
- public function __construct() {
- add_action( 'admin_menu', array( $this, 'register_subscriptions_page' ) );
- add_action( 'current_screen', array( $this, 'record_user_page_view' ) );
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
-
- // Priority 50 to run after Automattic\WooCommerce\Internal\Admin\Homescreen::update_link_structure() which runs on 20.
- add_action( 'admin_menu', array( $this, 'restructure_menu_order' ), 50 );
- }
-
- /**
- * Registers the WooCommerce → Subscriptions admin page.
- */
- public function register_subscriptions_page() {
- global $submenu;
-
- if ( 'yes' === get_option( $this->user_dismissed_option, 'no' ) ) {
- return;
- }
-
- if ( 'yes' !== get_option( 'woocommerce_allow_tracking', 'no' ) ) {
- return;
- }
-
- if ( ! $this->is_store_experiment_eligible() ) {
- return;
- }
-
- $menu_data = array(
- 'id' => $this->page_id,
- 'title' => _x( 'Subscriptions', 'Admin menu name', 'woocommerce' ),
- 'parent' => 'woocommerce',
- 'path' => '/subscriptions',
- 'capability' => 'manage_options',
- );
-
- wc_admin_register_page( $menu_data );
-
- if ( ! isset( $submenu['woocommerce'] ) || 'yes' === get_option( $this->user_viewed_option, 'no' ) ) {
- return;
- }
-
- // translators: Admin menu item badge. It is used alongside the "Subscriptions" menu item to grab attention and let merchants know that this is a new offering.
- $new_badge_text = __( 'new', 'woocommerce' );
-
- // Add the "new" badge.
- foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
- if ( self::SUBSCRIPTION_MENU_ITEM_SLUG === $menu_item[2] ) {
- $submenu['woocommerce'][ $key ][0] .= sprintf( ' ', esc_html( $new_badge_text ) ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
- break;
- }
- }
- }
-
- /**
- * Returns true if the store is eligible for the WooCommerce subscriptions empty state experiment.
- *
- * @return bool
- */
- private function is_store_experiment_eligible() {
- // Ineligible if WooCommerce Payments OR an existing subscriptions plugin is installed.
- $installed_plugins = PluginsHelper::get_installed_plugin_slugs();
- $plugin_ineligible_list = array(
- 'woocommerce-payments',
- 'woocommerce-subscriptions',
- 'subscriptio',
- 'subscriptions-for-woocommerce',
- 'subscriptions-for-woocommerce-pro',
- 'sumosubscriptions',
- 'yith-woocommerce-subscription',
- 'xa-woocommerce-subscriptions',
- );
- foreach ( $plugin_ineligible_list as $plugin_slug ) {
- if ( in_array( $plugin_slug, $installed_plugins, true ) ) {
- return false;
- }
- }
-
- // Ineligible if store address is not compatible with WCPay Subscriptions (US).
- $store_base_location = wc_get_base_location();
- if ( empty( $store_base_location['country'] ) || 'US' !== $store_base_location['country'] ) {
- return false;
- }
-
- // Ineligible if store has not been active for at least 6 months.
- if ( ! WCAdminHelper::is_wc_admin_active_in_date_range( 'month-6+' ) ) {
- return false;
- }
-
- // Ineligible if store has not had any sales in the last 30 days.
- if ( ! $this->get_store_recent_sales_eligibility() ) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Returns true if the store has an order that has been paid within the last 30 days.
- *
- * @return bool
- */
- private function get_store_recent_sales_eligibility() {
- $transient_key = 'woocommerce-wcpay-subscriptions_recent_sales_eligibility';
-
- // Load from cache.
- $is_eligible_cached = get_transient( $transient_key );
-
- // Valid cache found.
- if ( false !== $is_eligible_cached ) {
- return wc_string_to_bool( $is_eligible_cached );
- }
-
- // Get a single order that has been paid within the last 30 days.
- $orders = wc_get_orders(
- array(
- 'date_created' => '>' . strtotime( '-30 days' ),
- 'status' => wc_get_is_paid_statuses(),
- 'limit' => 1,
- 'return' => 'ids',
- )
- );
-
- $is_eligible = count( $orders ) >= 1;
- set_transient( $transient_key, wc_bool_to_string( $is_eligible ), DAY_IN_SECONDS );
-
- return $is_eligible;
- }
-
- /**
- * Registers when a user views the WCPay Subscriptions screen.
- *
- * Sets an option to prevent the notification badge from being displayed.
- */
- public function record_user_page_view() {
- $current_page = PageController::get_instance()->get_current_page();
-
- if ( isset( $current_page['id'] ) && $current_page['id'] === $this->page_id ) {
- update_option( $this->user_viewed_option, 'yes' );
- }
- }
-
- /**
- * Enqueues an inline script on WooCommerce registered pages for use
- * on the WooCommerce → Subscriptions admin page.
- */
- public function enqueue_scripts() {
- if ( ! PageController::get_instance()->is_registered_page() ) {
- return;
- }
-
- if ( ! $this->is_store_experiment_eligible() ) {
- return;
- }
-
- $data = array(
- 'newSubscriptionProductUrl' => add_query_arg(
- array(
- 'post_type' => 'product',
- 'select_subscription' => 'true',
- 'subscription_pointers' => 'true',
- ),
- admin_url( 'post-new.php' )
- ),
- 'onboardingUrl' => add_query_arg(
- array(
- 'wcpay-connect' => 'WC_SUBSCRIPTIONS_TABLE',
- '_wpnonce' => wp_create_nonce( 'wcpay-connect' ),
- ),
- admin_url( 'admin.php' )
- ),
- 'dismissOptionKey' => $this->user_dismissed_option,
- 'noThanksUrl' => wc_admin_url(),
- 'experimentAssignment' => $this->get_user_experiment_assignment(),
- );
-
- wp_add_inline_script( WC_ADMIN_APP, 'window.wcWcpaySubscriptions = ' . wp_json_encode( $data ), 'before' );
- }
-
- /**
- * Reorders the default WC admin menu items to ensure the Subscriptions item comes after orders.
- *
- * @see Automattic\WooCommerce\Internal\Admin\Homescreen::update_link_structure() which this approach is based on.
- */
- public function restructure_menu_order() {
- global $submenu;
- $wc_admin_menu = array();
- $subscriptions_menu_item = null;
-
- if ( ! isset( $submenu['woocommerce'] ) ) {
- return;
- }
- foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
- $wc_admin_menu[ $key ] = $menu_item;
-
- // Add a placeholder element for the Subscriptions item after the Orders element. We'll replace it later.
- if ( 'edit.php?post_type=shop_order' === $menu_item[2] ) {
- $wc_admin_menu['wcpay-subscriptions'] = 'wcpay-subscriptions';
- }
-
- // Keep a record of the subscriptions item and remove it from its current place in the menu.
- if ( self::SUBSCRIPTION_MENU_ITEM_SLUG === $menu_item[2] ) {
- $subscriptions_menu_item = $menu_item;
- unset( $wc_admin_menu[ $key ] );
- }
- }
-
- // Replace the placeholder element with the subscription menu item.
- if ( isset( $wc_admin_menu['wcpay-subscriptions'] ) && $subscriptions_menu_item ) {
- $wc_admin_menu['wcpay-subscriptions'] = $subscriptions_menu_item;
- $submenu['woocommerce'] = array_values( $wc_admin_menu ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
- }
- }
-
- /**
- * Returns the user's assignment for this experiment.
- *
- * @return string Either 'A' or 'B' to represent which treatment the user is assigned to.
- */
- private function get_user_experiment_assignment() {
- $anon_id = isset( $_COOKIE['tk_ai'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['tk_ai'] ) ) : '';
- $allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking' );
- $abtest = new Experimental_Abtest(
- $anon_id,
- 'woocommerce',
- $allow_tracking
- );
-
- return $abtest->get_variation( 'woocommerce_wcpay_subscriptions_page_202207_v1' ) === 'control' ? 'A' : 'B';
- }
-}