Modified WooCommerce Shipment Tracking plugin (3 posts)

  1. olicity
    Posted 3 years ago #

    As a time saver for others, if you are using the WooCommerce Shipment Tracking plugin, I made the following change to the plugin for it to work with non-sanitized strings being stored with an update_post_meta function through another plugin, in our case through the ShipWorks plugin for WooCommerce.

    echo '<option value="' . sanitize_title( $provider ) . '" ' . selected( sanitize_title( $provider ), $selected_provider, false ) . '>' . $provider . '</option>';

    I changed the selected from true to false, as it should not echo in an echo.

    Also I added sanitize_title to $selected_provider, since it would otherwise not match, since this is stored using all caps.

    Making this change, made the plugin automatically select the correct provider stored using a non-sanitized title.

    Hopefully the plugin developer will update their plugin so I can use the official version instead of my core modification.




  2. microguy
    Posted 3 years ago #

    Can you tell me how to make USPS the default provider?

  3. sscalifornia
    Posted 2 years ago #

    This is from the plugin documentation on http://docs.woothemes.com/document/shipment-tracking/

    Add this to your theme's functions.php:

    add_filter( 'woocommerce_shipment_tracking_default_provider', 'custom_woocommerce_shipment_tracking_default_provider' );
    function custom_woocommerce_shipment_tracking_default_provider( $provider ) {
    	$provider = 'fedex'; // Replace this with the name of the provider. See line 42 in the plugin for the full list.
    	return $provider;

    Replace fedex with USPS. This should be an option for the plugin, maybe it will.

    Hope that helps.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic