Commit e023bcf6f6 for woocommerce
commit e023bcf6f61e1ab7ab52ba71fe2d4e4ac78d318b
Author: Herman <KokkieH@users.noreply.github.com>
Date: Mon Feb 9 08:39:00 2026 +0200
Add marketplace links to settings pages (#63112)
* Add marketplace links to relevant Settings pages
* Add styling for new CTA
* Add tracking for clicks on new CTAs
* Use named function instead of anon to get the link tags
* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin
* Remove redundant isset check
* Construct link tags inline instead of via a function
* Combine two config arrays.
- Simplifies things now the link tags are no longer created via a separate function
- Also makes the config more robust--two arrays could get out of sync through careless code changes
* Add UTM params to external links
---------
Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>
diff --git a/plugins/woocommerce/changelog/63112-add-WOOMKT-534-marketplace-links-in-settings b/plugins/woocommerce/changelog/63112-add-WOOMKT-534-marketplace-links-in-settings
new file mode 100644
index 0000000000..87d937fad9
--- /dev/null
+++ b/plugins/woocommerce/changelog/63112-add-WOOMKT-534-marketplace-links-in-settings
@@ -0,0 +1,4 @@
+Significance: minor
+Type: add
+
+Adds Marketplace CTAs to some of the settings pages.
\ No newline at end of file
diff --git a/plugins/woocommerce/client/admin/client/wp-admin-scripts/settings-tracking/index.ts b/plugins/woocommerce/client/admin/client/wp-admin-scripts/settings-tracking/index.ts
index 5cd6214145..de7c50d58e 100644
--- a/plugins/woocommerce/client/admin/client/wp-admin-scripts/settings-tracking/index.ts
+++ b/plugins/woocommerce/client/admin/client/wp-admin-scripts/settings-tracking/index.ts
@@ -1 +1,5 @@
+/**
+ * Internal dependencies
+ */
export * from './exit-setting-page';
+import './marketplace-link-tracking';
diff --git a/plugins/woocommerce/client/admin/client/wp-admin-scripts/settings-tracking/marketplace-link-tracking.ts b/plugins/woocommerce/client/admin/client/wp-admin-scripts/settings-tracking/marketplace-link-tracking.ts
new file mode 100644
index 0000000000..35e32e6e10
--- /dev/null
+++ b/plugins/woocommerce/client/admin/client/wp-admin-scripts/settings-tracking/marketplace-link-tracking.ts
@@ -0,0 +1,26 @@
+/**
+ * External dependencies
+ */
+import { recordEvent } from '@woocommerce/tracks';
+
+const initMarketplaceLinkTracking = () => {
+ const container = document.querySelector( '.wc-settings-marketplace-link' );
+ if ( ! container ) {
+ return;
+ }
+
+ const link = container.querySelector( 'a' );
+ const settingsTab = container.getAttribute( 'data-settings-tab' );
+ const settingsSection = container.getAttribute( 'data-settings-section' );
+
+ if ( link && settingsTab ) {
+ link.addEventListener( 'click', () => {
+ recordEvent( 'settings_marketplace_link_click', {
+ settings_area: settingsTab,
+ settings_section: settingsSection || undefined,
+ } );
+ } );
+ }
+};
+
+initMarketplaceLinkTracking();
diff --git a/plugins/woocommerce/client/legacy/css/admin.scss b/plugins/woocommerce/client/legacy/css/admin.scss
index db2e68c79d..89a036e870 100644
--- a/plugins/woocommerce/client/legacy/css/admin.scss
+++ b/plugins/woocommerce/client/legacy/css/admin.scss
@@ -8975,6 +8975,17 @@ body.woocommerce_page_wc-settings {
margin-bottom: 0;
}
+ .wc-settings-marketplace-link {
+ padding-top: 16px;
+ border-top: 1px solid #c3c4c7;
+ color: #50575e;
+
+ a img {
+ margin-right: 4px;
+ vertical-align: text-bottom;
+ }
+ }
+
.woocommerce-layout__primary {
@media screen and (max-width: 782px) {
padding-top: 0 !important;
diff --git a/plugins/woocommerce/includes/admin/views/html-admin-settings.php b/plugins/woocommerce/includes/admin/views/html-admin-settings.php
index 7210fbb98a..e1894e3f58 100644
--- a/plugins/woocommerce/includes/admin/views/html-admin-settings.php
+++ b/plugins/woocommerce/includes/admin/views/html-admin-settings.php
@@ -46,6 +46,49 @@ if ( array_key_exists( 'advanced', $tabs ) ) {
$tabs['advanced'] = $advanced;
}
+$marketplace_base_url = trailingslashit(
+ esc_url_raw( apply_filters( 'woo_com_base_url', 'https://woocommerce.com/' ) )
+) . 'product-category/woocommerce-extensions/';
+
+$marketplace_links = array(
+ 'products' => array(
+ 'url' => $marketplace_base_url . 'merchandising/',
+ 'is_external' => true,
+ /* translators: %1$s: opening link tag, %2$s: closing link tag */
+ 'message' => __( '%1$sExplore solutions%2$s that help highlight products and drive more sales.', 'woocommerce' ),
+ ),
+ 'tax' => array(
+ 'url' => $marketplace_base_url . 'operations/sales-tax-and-duties/',
+ 'is_external' => true,
+ /* translators: %1$s: opening link tag, %2$s: closing link tag */
+ 'message' => __( '%1$sExplore solutions%2$s that help with tax calculations, compliance, and regional requirements.', 'woocommerce' ),
+ ),
+ 'shipping' => array(
+ 'url' => $marketplace_base_url . 'shipping-delivery-and-fulfillment/',
+ 'is_external' => true,
+ /* translators: %1$s: opening link tag, %2$s: closing link tag */
+ 'message' => __( '%1$sExplore solutions%2$s that enhance shipping, delivery, and fulfillment workflows.', 'woocommerce' ),
+ ),
+ 'account' => array(
+ 'url' => $marketplace_base_url . 'store-content-and-customizations/cart-and-checkout-features/',
+ 'is_external' => true,
+ /* translators: %1$s: opening link tag, %2$s: closing link tag */
+ 'message' => __( '%1$sExplore solutions%2$s that help customize cart and checkout flows.', 'woocommerce' ),
+ ),
+ 'email' => array(
+ 'url' => $marketplace_base_url . 'marketing-extensions/email-marketing-extensions/',
+ 'is_external' => true,
+ /* translators: %1$s: opening link tag, %2$s: closing link tag */
+ 'message' => __( '%1$sExplore solutions%2$s that help automate and improve customer email communication.', 'woocommerce' ),
+ ),
+ 'general' => array(
+ 'url' => admin_url( 'admin.php?page=wc-admin&path=%2Fextensions' ),
+ 'is_external' => false,
+ /* translators: %1$s: opening link tag, %2$s: closing link tag */
+ 'message' => __( '%1$sDiscover additional solutions%2$s to boost your business and expand what your store can do.', 'woocommerce' ),
+ ),
+);
+
?>
<div class="wrap woocommerce">
@@ -84,6 +127,45 @@ if ( array_key_exists( 'advanced', $tabs ) ) {
<?php endif; ?>
<?php wp_nonce_field( 'woocommerce-settings' ); ?>
</p>
+ <?php if ( isset( $marketplace_links[ $current_tab ] ) ) : ?>
+ <?php
+ $link_config = $marketplace_links[ $current_tab ];
+
+ if ( $link_config['is_external'] ) {
+ $utm_source = 'settings_' . $current_tab . ( $current_section ? '_' . $current_section : '' );
+ $link_url = add_query_arg( 'utm_source', $utm_source, $link_config['url'] );
+ $icon_url = WC()->plugin_url() . '/assets/images/icons/external-link.svg';
+ $external_icon = '<img src="' . esc_url( $icon_url ) . '" alt="" />';
+ $screen_reader = '<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'woocommerce' ) . '</span>';
+ $link_open = '<a href="' . esc_url( $link_url ) . '" target="_blank" rel="noopener noreferrer">' . $external_icon;
+ $link_close = $screen_reader . '</a>';
+ } else {
+ $link_open = '<a href="' . esc_url( $link_config['url'] ) . '">';
+ $link_close = '</a>';
+ }
+ ?>
+ <p class="wc-settings-marketplace-link" data-settings-tab="<?php echo esc_attr( $current_tab ); ?>"<?php echo $current_section ? ' data-settings-section="' . esc_attr( $current_section ) . '"' : ''; ?>>
+ <?php
+ echo wp_kses(
+ sprintf( $link_config['message'], $link_open, $link_close ),
+ array(
+ 'a' => array(
+ 'href' => array(),
+ 'target' => array(),
+ 'rel' => array(),
+ ),
+ 'img' => array(
+ 'src' => array(),
+ 'alt' => array(),
+ ),
+ 'span' => array(
+ 'class' => array(),
+ ),
+ )
+ );
+ ?>
+ </p>
+ <?php endif; ?>
</form>
<?php do_action( 'woocommerce_after_settings_' . $current_tab ); ?>
</div>