diff --git a/plugins/woocommerce-admin/client/profile-wizard/steps/business-details/flows/selective-bundle/selective-extensions-bundle/index.js b/plugins/woocommerce-admin/client/profile-wizard/steps/business-details/flows/selective-bundle/selective-extensions-bundle/index.js
index 44b6ec8f6b6..bb5c3642c4f 100644
--- a/plugins/woocommerce-admin/client/profile-wizard/steps/business-details/flows/selective-bundle/selective-extensions-bundle/index.js
+++ b/plugins/woocommerce-admin/client/profile-wizard/steps/business-details/flows/selective-bundle/selective-extensions-bundle/index.js
@@ -328,6 +328,34 @@ const getVisiblePlugins = ( plugins, country, industry, productTypes ) => {
);
};
+/**
+ * Returns bundles that have at least 1 visible plugin.
+ *
+ * @param {Array} bundles list of bundles
+ * @param {string} country Woo store country
+ * @param {Array} industry List of selected industries
+ * @param {Array} productTypes List of selected product types
+ *
+ * @return {Array} Array of visible bundles
+ */
+const getVisibleBundles = ( bundles, country, industry, productTypes ) => {
+ return bundles
+ .map( ( bundle ) => {
+ return {
+ ...bundle,
+ plugins: getVisiblePlugins(
+ bundle.plugins,
+ country,
+ industry,
+ productTypes
+ ),
+ };
+ } )
+ .filter( ( bundle ) => {
+ return bundle.plugins.length;
+ } );
+};
+
const transformRemoteExtensions = ( extensionData ) => {
return extensionData.map( ( section ) => {
const plugins = section.plugins.map( ( plugin ) => {
@@ -400,7 +428,14 @@ export const SelectiveExtensionsBundle = ( {
industry,
productTypes
);
- setInstallableExtensions( installableExtensionsData );
+ setInstallableExtensions(
+ getVisibleBundles(
+ installableExtensionsData,
+ country,
+ industry,
+ productTypes
+ )
+ );
setValues( initialValues );
setIsFetching( false );
};
@@ -428,7 +463,14 @@ export const SelectiveExtensionsBundle = ( {
industry,
productTypes
);
- setInstallableExtensions( transformedExtensions );
+ setInstallableExtensions(
+ getVisibleBundles(
+ transformedExtensions,
+ country,
+ industry,
+ productTypes
+ )
+ );
setValues( initialValues );
setIsFetching( false );
} )
@@ -520,21 +562,18 @@ export const SelectiveExtensionsBundle = ( {
{ isFetching ? (
) : (
- getVisiblePlugins(
- plugins,
- country,
- industry,
- productTypes
- ).map( ( { description, key } ) => (
-
- ) )
+ plugins.map(
+ ( { description, key } ) => (
+
+ )
+ )
) }
)
diff --git a/plugins/woocommerce-admin/readme.txt b/plugins/woocommerce-admin/readme.txt
index 0baab31bd81..490316cdf8b 100644
--- a/plugins/woocommerce-admin/readme.txt
+++ b/plugins/woocommerce-admin/readme.txt
@@ -79,6 +79,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Add: Add unit tests around extended payment gateway controller #7133
- Fix: WCPay not working in local payments task #7151
- Fix: Include onboarding settings on the analytic pages #7109
+- Fix: RemoteFreeExtension hide bundle when all of its plugins are not visible #7182
- Tweak: Revert Card component removal #7167
== 2.4.0 6/10/2021 ==