“Shipment 1” Appears on Cart and Checkout After Update to Woo 10.5.1
-
Hi WooCommerce Support Team,
After updating WooCommerce to Version 10.5.1, i noticed a change in the cart and checkout page display on my website: https://lance-spumare.ro
On the cart page and also on the checkout page there are not show “Livrare” as before update (Livrare means Shipping/Shipping), and there is now show “Livrare 1” (Shipment 1).
I’m experiencing an inconsistency between Cart and Checkout regarding the shipping package title. After updating WooCommerce, “Shipment 1” started appearing instead of just “Shipment”. As suggested in other thread opened for similar problem, I implemented the provided woocommerce_shipping_package_name snippet to remove the numbering when there is only one package.The snippet works correctly on the Checkout page, where only “Shipment” is displayed.However, on the Cart page, it still shows “Shipment 1”, even though there is only one shipping package (count($packages) === 1).I have confirmed via debugging that:There is only one shipping package in Cart. The filter woocommerce_shipping_package_name is running.The issue appears to affect only the Cart page.
Could you please clarify:
- Is the Cart page using a different rendering logic for shipping package titles?
- Is there another filter or template override specifically affecting the Cart totals output?
- Has anything changed recently in how data-title attributes for shipping rows are generated in Cart?
How can we change it back to display simply as “Shipping” instead of “Shipment 1”?
I want to keep logical functionality of woocommerce, in according with the factura that maybe over some years i will have more delivery packages, and to keep number of packeges display.
Below you can see the code I used to solve the problem, but as I already told you above, it solved the problem only on Checkout page, wihout solved the problem on the Cart page too.
add_filter(‘woocommerce_shipping_package_name’, function ($name, $package_id, $package) {
// Safety fallback in case, for a rare reason, shipping is not yet available.
if ( ! function_exists(‘WC’) || ! WC() || ! WC()->shipping() ) {
return $name;
}
$packages = WC()->shipping()->get_packages();
// If there is only one package, we no longer display the number.
if (is_array($packages) && count($packages) === 1) {
return __(‘Livrare’, ‘woocommerce’);
}
// If there are multiple packages, we keep the numbering.
return sprintf(__(‘Livrare %d’, ‘woocommerce’),
(int) $package_id + 1);
}, 20, 3);
I would appreciate clarification on whether this is expected behavior and the recommended way to handle it.
Thank you in advance for your support.
You must be logged in to reply to this topic.