Skip to content

[Backport to release/10.6] Fix checkout cart [shortcode] Shipment label is not correct#63649

Merged
tpaksu merged 3 commits intorelease/10.6from
cherry-pick-PR63645-to-release/10.6
Mar 12, 2026
Merged

[Backport to release/10.6] Fix checkout cart [shortcode] Shipment label is not correct#63649
tpaksu merged 3 commits intorelease/10.6from
cherry-pick-PR63645-to-release/10.6

Conversation

@woocommercebot
Copy link
Collaborator

This PR is a cherry-pick of #63645 to release/10.6.

Original PR Description

This PR is a follow up to #63346, please follow up the instructions on #63346 for testing

Show shipping package title as "Shipment" instead of "Shipment 1" if there is only 1 package.

Changes proposed in this Pull Request:

Send the count of the total number of packages to the get_shipping_package_name() method so that the package can be conditionally named "Shipment" if there is only 1 package in total.... or "Shipment 1", "Shipment 2", etc if there are multiple packages.

Closes #63336.

(For Bug Fixes)
Potentially introduced in daae10d#diff-cdc9f1829f52d7b83e3542948622d924ef5cf6a3e0b4580e6ebd1c9643bc49b4L261 .

Screenshots or screen recordings:

Before:
image

After:
image

more than 1 package will still show the same... "Shipment 1, Shipment 2, etc"

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Put a single product that requires shipping in the cart
  2. Visit the cart shortcode
  3. See the shipping area reads "Shipment"

Testing that has already taken place:

Milestone

Note: Check the box above to have the milestone automatically assigned when merged.
Alternatively (e.g. for point releases), manually assign the appropriate 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

Changelog Entry Comment

Comment

Summary by CodeRabbit

Bug Fixes

  • The way shipping packages are named and displayed in your cart has been improved. Packages now appear as "Shipment" instead of "Shipment 1" when you review your order, check available shipping options, and proceed through checkout. This change delivers a cleaner and more consistent presentation of your shipping information.

* Show shipping package title as "Shipment" instead of "Shipment 1" if there is only 1 package. Closes #63336.

* add changelog

* Cleanup the logic around showing the package number

* Update tests for the introduced change

* Update filter docs

---------

Co-authored-by: helgatheviking <[email protected]>
@woocommercebot woocommercebot requested a review from a team as a code owner March 12, 2026 10:32
@woocommercebot woocommercebot requested review from samnajian and senadir and removed request for a team March 12, 2026 10:32
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Mar 12, 2026
@github-actions github-actions bot added this to the 10.6.0 milestone Mar 12, 2026
@github-actions
Copy link
Contributor

Testing Guidelines

Hi @samnajian @senadir ,

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.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

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.

@tpaksu tpaksu merged commit 1f803ca into release/10.6 Mar 12, 2026
51 checks passed
@tpaksu tpaksu deleted the cherry-pick-PR63645-to-release/10.6 branch March 12, 2026 12:53
@github-actions github-actions bot added metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. needs: documentation The issue/PR requires documentation to be added. labels Mar 12, 2026
@jpelectronicindia-droid

Dear WooCommerce Support Team,

After updating our store to WooCommerce version 10.6.1, we noticed that the recent fix introduced the label “Shipment” instead of “Shipment 1” on the checkout page, which we understand was intended as an improvement.

However, we are currently facing another issue related to this change. In our store, we previously customized this label to “Delivery Charges” using Loco Translate. After the update, the text “Shipment” no longer appears in the translation strings, and even when we attempt to translate it through Loco Translate, the label on the checkout page does not change.

This creates a problem because our checkout page now displays “Shipment”, while our store terminology requires “Delivery Charges” for better clarity for customers.

We kindly request your team to review this behavior and advise whether:

The string “Shipment” is now generated dynamically and therefore cannot be translated via standard translation files.
There is a recommended filter or hook that allows store owners to modify this label.
A fix or improvement can be included in an upcoming WooCommerce update to allow proper translation/customization.

For reference, this issue started after the fix mentioned in the WooCommerce changelog:

We would greatly appreciate your guidance on how to properly change this label to “Delivery Charges.”

Thank you for your continued support and for the improvements your team brings to WooCommerce.

https://drive.google.com/file/d/1BZXJU7GLFUuxOZ73RfutAl2aislrEtCn/view?usp=drivesdk

@ktmn
Copy link

ktmn commented Mar 13, 2026

@jpelectronicindia-droid Does the string not show up after you press "Sync" in Loco Translate? (the button is visible on the image you posted)
If not, you can use this filter in your child theme's functions.php or a mu-plugin:

add_filter('gettext_with_context_woocommerce', function($translation, $text, $context) {

	if($context === 'shipping packages') {

		if($text === 'Shipment') {
			return 'Delivery Charges';
		}

		if($text === 'Shipment %d') {
			return 'Delivery Charges %d';
		}
	}

	return $translation;
}, 10, 3);

@jpelectronicindia-droid

Dear WooCommerce Support Team,

After pressing “Sync” in Loco Translate, the string “Shipment” still does not appear in the translation list. Because of this, it cannot be translated directly through Loco Translate.

As a temporary workaround, we tested the following filter in the child theme’s functions.php, which successfully changes the label from “Shipment” to “Delivery Charges” on the checkout page:

add_filter('gettext_with_context_woocommerce', function($translation, $text, $context) {

    if($context === 'shipping packages') {

        if($text === 'Shipment') {
            return 'Delivery Charges';
        }

        if($text === 'Shipment %d') {
            return 'Delivery Charges %d';
        }
    }

    return $translation;
}, 10, 3);

However, the issue remains that the string added/changed via Loco Translate is not detected or translated, even after syncing.

Could you please advise on how this string can be properly made translatable in Loco Translate, or confirm if this is a known issue introduced in WooCommerce 10.5?

@jpelectronicindia-droid
Copy link

@samnajian
Copy link
Contributor

gettext_with_context_woocommerce

@jpelectronicindia-droid
As gettext_with_context_woocommerce filter works, it confirms WordPress is seeing a normal translation string at run time, the bug can be in your local translation files or the Loco translate plugin.

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

Labels

metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. needs: documentation The issue/PR requires documentation to be added. plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants