Skip to content

fix: add the saas onboarding pattern to the shop, checkout and order received - #20

Open
YvesCesar wants to merge 2 commits into
mainfrom
fix/saas-onboarding-pattern
Open

YvesCesar wants to merge 2 commits into
mainfrom
fix/saas-onboarding-pattern

Conversation

@YvesCesar

@YvesCesar YvesCesar commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Closes #19.

The libresign/saas-onboarding pattern was referenced but never registered, so nothing was rendered on the shop, checkout and order received pages.

  • Adds patterns/saas-onboarding.php: a heading and three steps (choose a plan, create your workspace, start signing). Strings are in English under the libresign text domain, so they reach Weblate through the usual .pot update.
  • Calls the pattern from the archive-product and page-checkout templates, as order-confirmation already did.
  • Removes the prepend from the the_content filter in inc/account.php. On the shop it never ran, since archive-product has no post-content block, and on the order received page the template already rendered the pattern. The function now only handles the account page, so it is renamed to libresign_theme_render_account_content.
  • Hides the onboarding when paying an existing order (order-pay) and when the received order is a renewal, switch or resubscribe of an existing subscription (inc/onboarding.php), since that customer already has a workspace.
  • Loads WooCommerce Subscriptions in the integration harness (same package as woocommerce-restrict-switch) to cover those orders.
  • Integration test renders the three templates and checks the onboarding appears once in each.
  • E2E test checks the onboarding on the real shop, checkout and order received pages, and its absence on a product page.

After deploy, the archive-product template saved in the database through the Site Editor overrides the theme file. Clearing its customizations (as listed in #13) is needed for the shop to show the onboarding.

…received

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar
YvesCesar marked this pull request as draft October 2, 2026 15:51
…ing an order of an existing subscription

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar
YvesCesar marked this pull request as ready for review October 2, 2026 16:06
@YvesCesar
YvesCesar requested a review from vitormattos October 2, 2026 16:11
Base automatically changed from test/e2e-playwright to main October 5, 2026 02:29
Comment thread inc/onboarding.php
return $block_content;
}

if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'order-pay' ) ) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Existing subscription flows also go through the normal checkout.

WooCommerce Subscriptions builds the cart and redirects renewals, resubscriptions and switches to wc_get_checkout_url(). At that point order-pay is no longer set and there is no order-received yet, so this filter will render the onboarding during checkout.

The plugin already provides wcs_cart_contains_renewal(), wcs_cart_contains_resubscribe() and wcs_cart_contains_switches() to identify these flows.

Since this onboarding should only be shown when buying a new plan, we should also hide it for these cart states and cover them with tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants