WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Modified WooCommerce Shipment Tracking plugin (3 posts)

  1. olicity
    Member
    Posted 11 months 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.

    Thanks,

    Kim

    http://wordpress.org/extend/plugins/woocommerce/

  2. microguy
    Member
    Posted 11 months ago #

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

  3. sscalifornia
    Member
    Posted 1 month 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.

Reply

You must log in to post.

About this Plugin

About this Topic