Support » Plugin: Printful Integration for WooCommerce » Change Shipping Package Name for Printful Orders

  • Resolved lunkerlab


    I’m trying sell Printful products, along with my own products that I ship myself. WooCommerce handles the split shipping rates within the cart and at checkout by labeling them “Shipping” and “Shipping 2”. I’m looking for a hook to add to my functions that would rename “shipping 2” text to “Printful Shipping”. I found a function (see below) that can change the text, but not one that can recognize the difference between the WooCommerce, and the Printful. Being able to give them a more distinct name would help to alleviate any confusion my customers may have when they see the two separate shipping charges. Any help would be most appreciated!



    this hook works to change the name, but it gives it the same name for both

    add_filter( ‘woocommerce_shipping_package_name’, ‘custom_shipping_package_name’ );
    function custom_shipping_package_name( $name ) {
    return ‘Your Text’;

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there,

    In order to achieve this your package should have a custom attribute or you can check the kind of products that are in it.

    You can pass a second var on your function, like this:

    add_filter( 'woocommerce_shipping_package_name', 'fa_custom_shipping_package_name', 10, 2 );
    function fa_custom_shipping_package_name( $default_name, $package ) {
      if ( $package['custom_attribute'] === 'printful' ) {
        return 'Custom name';
      return $default_name;

    In this sample I consider you’ve an attribute called “custom_attribute”. You can use print_r( $package ) to debug your package.

    Thanks for the help! With my fairly basic understanding of php, I had a hard time trying to figure out where & how to place the custom attribute… I did fine the shipping method that handles the shipping package numbers in the “wc-cart-functions.php” file. I then used this function to only change the “shipping 2” text

    add_filter( ‘woocommerce_shipping_package_name’ , ‘custom_shipping_package_name’, 10, 3);
    function custom_shipping_package_name($package_name, $i, $package){
    return sprintf( _nx( ‘Shipping’, ‘Custom Shipping Name %d’, ( $i + 1 ), ‘shipping packages’, ‘nl_nl’ ), ( $i + 1 ) );

    Not sure if this is a total hack job code wise (any advice would be appreciated)… Now I just need to figure out how to remove the variable that adds the number without breaking the function. Thanks Again!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Shipping Package Name for Printful Orders’ is closed to new replies.