Use Step Label as Page Title

Created on 14 February 2020, over 5 years ago
Updated 14 August 2025, 2 days ago

Problem/Motivation

Currently, the checkout process has a hard-coded page title of 'Checkout' in commerce_checkout.routing.yml which is an issue with SEO/readability/consistency since the H1 provided by CheckoutFlowBase::buildForm() is never actually "Checkout" but instead it is things like "Payment", "Complete", and "Login."

Proposed resolution

Use the current step label as the page title.

Feature request
Status

Needs review

Version

2.0

Component

Checkout

Created by

🇺🇸United States daniel korte Brooklyn, NY

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇷Costa Rica estebanvalerio.h

    We are using this patch and it is working as expected.

    I can see the patch applied and on getFormPageTitle() method, I added a dummy text at the end of title being returned to confirm the Title is updated: return $steps[$step_id]['label'] . ' TEST';

    In the attached image, I can see the title updated after following a commerce workflow.

    Patch is applied with composer:

    "drupal/commerce": {
                    "3113563 - Use Step Label as Page Title": "https://www.drupal.org/files/issues/2020-02-13/3113563-step-label-as-page-title-2.patch"
                },
    
  • 🇮🇱Israel jsacksick

    Discussed this with Ryan on Slack, perhaps we should mimic what we were doing in Commerce 1.x which is:
    Checkout: [step label]. (We probably should wrap that in a t().

    $this->t('Checkout: @step_label'); Thoughts?

  • 🇮🇱Israel jsacksick

    The first comment mentions SEO which is not really a concern for checkout pages which are typically not indexed and shouldn't be.

Production build 0.71.5 2024