skip to Main Content
Due to personal health issues there is currently a delay in support response time.
I greatly apologize for this inconvenience and will respond to each ticket as soon as I can.

Change Shipping Package Title

As of WooCommerce 2.6, the package titles are now able to be something more than Shipping #1, Shipping #2, etc… Using a filter, one can change the titles to something more helpful. For example, if you separate your cart into packages based on individual shipping classes, you could title the package after the class itself. The example code below will do just that:

function wc_change_pkg_titles( $current_title, $pkg_id, $package ) {

    // exit if package error
    if( ! isset( $package['contents'] ) || ! is_array( $package['contents'] ) ) return $current_title;

    foreach( $package['contents'] as $key => $item ) {
        $product = $item['data'];
        $shipping_class_id = $product->get_shipping_class_id();
        $shipping_class = get_term( $shipping_class_id );

    return ( $shipping_class ) ? $shipping_class->name : $current_title;
add_filter( 'woocommerce_shipping_package_name', 'wc_change_pkg_titles', 10, 3 );

  • Was this article helpful ?
  • yesno
2 out of 2 visitors found this article helpful
Views: 1395
Back To Top