• 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.

    Thanks,

    Kim

    https://www.ads-software.com/extend/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Can you tell me how to make USPS the default provider?

    sscalifornia

    (@sscalifornia)

    This is from the plugin documentation on https://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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Modified WooCommerce Shipment Tracking plugin’ is closed to new replies.