Skip to content

Onboarding: Add US/Chile shipping onboarding coverage#63348

Merged
ebinnion merged 4 commits intotrunkfrom
update/chile-argentia-shipping-recommendations
Feb 18, 2026
Merged

Onboarding: Add US/Chile shipping onboarding coverage#63348
ebinnion merged 4 commits intotrunkfrom
update/chile-argentia-shipping-recommendations

Conversation

@ebinnion
Copy link
Copy Markdown
Contributor

@ebinnion ebinnion commented Feb 17, 2026

The root issue here appears to be that the shipping recommendations from WooCommerce.com expect that a plugin only downloadable if there is a slug to a WordPress.org plugin. Otherwise, the merchant should click "Learn More". This PR will fall back to the primary action being "download" and then linking the merchant to download the extension on WooCommerce.com.

Changes proposed in this Pull Request:

  • Fix shipping onboarding recommendation flow so the label-printing step is visible when there is a promoted partner, including non-installable partners (for example Envia with empty slug).
  • Keep installable partner detection explicit (hasInstallableSlug) and treat empty/whitespace slugs as non-installable.
  • Add onboarding e2e coverage for:
    • US store: shows Install and enable.
    • Chile store: shows Download and does not show Install and enable.
  • Add/adjust shipping unit coverage for slug handling edge cases.

How to test the changes in this Pull Request:

  1. Build admin assets: pnpm --filter='@woocommerce/plugin-woocommerce' build:admin
  2. Confirm tests pass
  3. Manually test in local environment.
    • cd plugins/woocommerce && wp-env start
    • Log in to wp-admin with username:admin and password:password
    • Go to WooCommerce menu item.
    • Skip guided setup
    • Select Argentina or Chile
    • On onboarding checklist, select shipping settings option
    • Step through the options, selecting a price for shipping cost
    • Ensure that step 3 shows something like the following:
CleanShot 2026-02-17 at 11 09 30@2x

Testing that has already taken place:

  • Automated tests
  • Manual testing

Milestone

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Fix shipping onboarding recommendations so non-installable partners show Download and the label-printing step remains visible.

Changelog Entry Comment

Comment

N/A

@github-actions github-actions Bot added focus: e2e tests Issues related to e2e tests plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Feb 17, 2026
@ebinnion ebinnion modified the milestones: 10.6.0, 10.7.0 Feb 17, 2026
@ebinnion ebinnion requested review from a team and ayushpahwa and removed request for a team February 17, 2026 17:42
@ebinnion ebinnion self-assigned this Feb 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 17, 2026

Testing Guidelines

Hi @ayushpahwa ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@ebinnion ebinnion marked this pull request as ready for review February 17, 2026 19:43
@github-actions github-actions Bot removed the focus: e2e tests Issues related to e2e tests label Feb 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Size Change: +36 B (0%)

Total Size: 5.98 MB

compressed-size-action

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new helper function hasInstallableSlug() to validate shipping method slug properties and refactors the shipping onboarding extension to consistently use this helper for slug checks, replacing direct property access patterns.

Changes

Cohort / File(s) Summary
Changelog
plugins/woocommerce/changelog/fix-shipping-onboarding-extension-actions
Changelog entry documenting a patch-level fix for shipping onboarding extension action display issues.
Shipping Extension Logic
plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js
Added new public helper function hasInstallableSlug() to validate that a shipping method has a non-empty trimmed slug string. Refactored existing logic to use this helper when filtering pluginsToActivate, determining shipping step visibility, and rendering single-plugin recommendations with fallback to Download buttons.
Shipping Extension Tests
plugins/woocommerce/client/admin/client/task-lists/fills/shipping/test/index.tsx
Added test data for partners with and without slugs, plus three new test cases validating hasInstallableSlug() behavior with valid slugs, empty slugs, and empty objects.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the root issue, proposed changes, testing instructions, and includes a changelog entry directly related to the shipping onboarding recommendation flow fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'Onboarding: Add US/Chile shipping onboarding coverage' directly describes the main changes in the PR, which adds shipping onboarding coverage for US and Chile stores with new tests and fixes to the shipping recommendation flow.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update/chile-argentia-shipping-recommendations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js (2)

213-217: DRY: reuse hasInstallableSlug here instead of duplicating its logic.

The filter predicate duplicates the check that hasInstallableSlug already encapsulates. Since you're mapping to just the slug string first, a small restructure would keep this DRY.

♻️ Suggested refactor
-		const pluginsToActivate = pluginsToPromote
-			.map( ( pluginToPromote ) => pluginToPromote.slug )
-			.filter(
-				( slug ) => typeof slug === 'string' && slug.trim().length > 0
-			);
+		const pluginsToActivate = pluginsToPromote
+			.filter( hasInstallableSlug )
+			.map( ( pluginToPromote ) => pluginToPromote.slug );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js`
around lines 213 - 217, The current map-then-filter duplicates logic; instead
use hasInstallableSlug to DRY this. Change the pipeline so you first filter
pluginsToPromote with hasInstallableSlug and then map to plugin.slug (i.e.,
pluginsToActivate = pluginsToPromote.filter(hasInstallableSlug).map(p =>
p.slug)); reference hasInstallableSlug, pluginsToPromote and pluginsToActivate
to locate and replace the existing map(...).filter(...) sequence.

381-381: visible is a number here; other steps use explicit booleans.

pluginsToPromote.length evaluates to a number (truthy when > 0), while other visible fields use true/false. Functionally fine, but pluginsToPromote.length > 0 would be more consistent.

♻️ Suggested fix
-				visible: pluginsToPromote.length,
+				visible: pluginsToPromote.length > 0,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js`
at line 381, The visible property is set to a number via
pluginsToPromote.length; change it to an explicit boolean for consistency by
using pluginsToPromote.length > 0 (i.e., replace visible:
pluginsToPromote.length with visible: pluginsToPromote.length > 0), locating the
assignment to visible near the pluginsToPromote variable in the
shipping/index.js fill step.
plugins/woocommerce/client/admin/client/task-lists/fills/shipping/test/index.tsx (1)

89-99: Good coverage of the core cases. Consider adding a whitespace-only slug test (slug: ' ') since hasInstallableSlug explicitly trims — this would exercise that branch.

🧪 Optional additional test
 	it( 'treats missing slugs as non-installable partners', () => {
 		expect( hasInstallableSlug( {} ) ).toBe( false );
 	} );
+
+	it( 'treats whitespace-only slugs as non-installable partners', () => {
+		expect( hasInstallableSlug( { slug: '   ' } ) ).toBe( false );
+	} );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@plugins/woocommerce/client/admin/client/task-lists/fills/shipping/test/index.tsx`
around lines 89 - 99, Add a test case exercising the trim branch of
hasInstallableSlug by asserting that a partner object with a whitespace-only
slug (e.g., { slug: '   ' }) is treated as non-installable; locate the test
block in the file that contains the existing cases for
usShippingPartner/chileShippingPartner/missing slug and add a new it() asserting
hasInstallableSlug({ slug: '   ' }) returns false so the trimming logic is
covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js`:
- Around line 213-217: The current map-then-filter duplicates logic; instead use
hasInstallableSlug to DRY this. Change the pipeline so you first filter
pluginsToPromote with hasInstallableSlug and then map to plugin.slug (i.e.,
pluginsToActivate = pluginsToPromote.filter(hasInstallableSlug).map(p =>
p.slug)); reference hasInstallableSlug, pluginsToPromote and pluginsToActivate
to locate and replace the existing map(...).filter(...) sequence.
- Line 381: The visible property is set to a number via pluginsToPromote.length;
change it to an explicit boolean for consistency by using
pluginsToPromote.length > 0 (i.e., replace visible: pluginsToPromote.length with
visible: pluginsToPromote.length > 0), locating the assignment to visible near
the pluginsToPromote variable in the shipping/index.js fill step.

In
`@plugins/woocommerce/client/admin/client/task-lists/fills/shipping/test/index.tsx`:
- Around line 89-99: Add a test case exercising the trim branch of
hasInstallableSlug by asserting that a partner object with a whitespace-only
slug (e.g., { slug: '   ' }) is treated as non-installable; locate the test
block in the file that contains the existing cases for
usShippingPartner/chileShippingPartner/missing slug and add a new it() asserting
hasInstallableSlug({ slug: '   ' }) returns false so the trimming logic is
covered.

@github-actions
Copy link
Copy Markdown
Contributor

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

@ebinnion ebinnion changed the title Onboarding: ShippingAdd US/Chile shipping onboarding coverage Onboarding: Add US/Chile shipping onboarding coverage Feb 18, 2026
Copy link
Copy Markdown
Contributor

@ayushpahwa ayushpahwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good and the testing instructions work as expected. I was able to reproduce the error on trunk and this PR fixed it. Thanks for working on this and adding the tests. :shipit:

@ebinnion ebinnion merged commit e599d0f into trunk Feb 18, 2026
41 checks passed
@ebinnion ebinnion deleted the update/chile-argentia-shipping-recommendations branch February 18, 2026 14:43
samnajian pushed a commit that referenced this pull request Mar 11, 2026
* Add US/Chile shipping onboarding coverage

* Add changelog

* test: restore shipping task e2e teardown state

* test: replace shipping CTA e2e checks with unit coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants