1. Home
  2. WC Vendors Pro
  3. Code Snippets
  4. Add extra shipping providers for vendor tracking numbers

Add extra shipping providers for vendor tracking numbers

WC Vendors Pro allows vendors to add a tracking number. We provide a shipping tracking provider drop down for various countries. The URL that is sent to the customer embeds the tracking number into the URL. If you want to add a new shipping provider to your country or even a new country with providers we provide a filter for this. You will need to know the format off the URL for the shipping provider to ensure it generates a usable URL for the customer. 

Filter Name : wcv_shipping_providers_list

Our shipping provider format looks like the following

$country = array( 'Country' => array ( 'Provider name' => 'formatted url' ) ); 

The ‘provider name’ is what the vendor sees in the tracking providers list.

The ‘formatted url’ is the url that is provided by the tracking company. Most tracking companies parse the tracking number as a part of the URL. This means that you can add this to generate the URL for the customer to be able to click and send them directly to their package details. 

Example: Fedex

https://www.fedex.com/fedextrack/?tracknumbers=TRACKINGNUMBER

This translates to a formatted url as:

https://www.fedex.com/fedextrack/?tracknumbers=%1$s

You would replace the tracking number with %1$s  as is shown in the new URL above. 

Our existing list of shipping providers are listed here

$shipping_providers = array(
			'Australia'           => array(
				'Australia Post'   => 'https://auspost.com.au/mypost/track/#/details/%1$s',
				'FedEx'            => 'https://www.fedex.com/apps/fedextrack/?tracknumbers=%1$s&cntry_code=au',
				'Fastway Couriers' => 'https://www.fastway.com.au/tools/track/?l=%1$s',
			),
			'Austria'             => array(
				'post.at' => 'https://www.post.at/sv/sendungsdetails?snr=%1$s',
				'dhl.at'  => 'https://www.dhl.at/content/at/de/express/sendungsverfolgung.html?brand=DHL&AWB=%1$s',
				'DPD.at'  => 'https://tracking.dpd.de/parcelstatus?locale=de_AT&query=%1$s',
			),
			'Brazil'              => array(
				'Correios' => 'http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=%1$s',
			),
			'Belgium'             => array(
				'bpost' => 'https://track.bpost.be/btr/web/#/search?itemCode=%1$s',
			),
			'Canada'              => array(
				'Canada Post' => 'https://www.canadapost.ca/cpotools/apps/track/personal/findByTrackNumber?trackingNumber=%1$s',
				'Fedex'       => 'http://www.fedex.com/Tracking?action=track&tracknumbers=%1$s',
				'UPS'         => 'http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=%1$s',
				'Purolator'   => 'https://www.purolator.com/purolator/ship-track/tracking-summary.page?pin=%1$s',
			),
			'Germany'             => array(
				'DHL Intraship (DE)' => 'http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=%1$s&rfn=&extendedSearch=true',
				'Hermes'             => 'https://tracking.hermesworld.com/?TrackID=%1$s',
				'Deutsche Post DHL'  => 'http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&idc=%1$s',
				'UPS Germany'        => 'http://wwwapps.ups.com/WebTracking/processInputRequest?sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=de_DE&InquiryNumber1=%1$s',
				'DPD'                => 'https://tracking.dpd.de/parcelstatus?query=%1$s&locale=en_DE',
			),
			'Czech Republic'      => array(
				'PPL.cz'      => 'https://www.ppl.cz/main2.aspx?cls=Package&idSearch=%1$s',
				'Česká pošta' => 'https://www.postaonline.cz/trackandtrace/-/zasilka/cislo?parcelNumbers=%1$s',
				'DHL.cz'      => 'https://www.dhl.cz/cs/express/sledovani_zasilek.html?AWB=%1$s',
				'DPD.cz'      => 'https://tracking.dpd.de/parcelstatus?locale=cs_CZ&query=%1$s',
			),
			'Finland'             => array(
				'Itella' => 'https://www.posti.fi/itemtracking/posti/search_by_shipment_id?lang=en&ShipmentId=%1$s',
			),
			'France'              => array(
				'Colissimo' => 'https://www.laposte.fr/outils/suivre-vos-envois?code=%1$s',
			),
			'Ireland'             => array(
				'DPD' => 'http://www2.dpd.ie/Services/QuickTrack/tabid/222/ConsignmentID/%1$s/Default.aspx',
			),
			'Italy'               => array(
				'BRT (Bartolini)' => 'https://as777.brt.it/vas/sped_det_show.hsm?referer=sped_numspe_par.htm&Nspediz=%1$s',
				'DHL Express'     => 'https://www.dhl.it/it/express/ricerca.html?AWB=%1$s&brand=DHL',
			),
			'India'               => array(
				'DTDC' => 'https://www.dtdc.in/dtdcTrack/Tracking/consignInfo.asp?strCnno=%1$s',
			),
			'Netherlands'         => array(
				'PostNL'          => 'https://postnl.nl/tracktrace/?B=%1$s&P=%2$s&D=%3$s&T=C',
				'DPD.NL'          => 'https://tracking.dpd.de/status/en_US/parcel/%1$s',
				'UPS Netherlands' => 'https://wwwapps.ups.com/WebTracking?sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=nl_NL&InquiryNumber1=%1$s',
			),
			'New Zealand'         => array(
				'Courier Post' => 'https://trackandtrace.courierpost.co.nz/Search/%1$s',
				'NZ Post'      => 'https://www.nzpost.co.nz/tools/tracking?trackid=%1$s',
				'Fastways'     => 'http://www.fastway.co.nz/courier-services/track-your-parcel?l=%1$s',
				'PBT Couriers' => 'http://www.pbt.com/nick/results.cfm?ticketNo=%1$s',
				'Aramex'       => 'https://www.aramex.co.nz/tools/track?l=%1$s',
			),
			'Poland'              => array(
				'InPost'        => 'https://inpost.pl/sledzenie-przesylek?number=%1$s',
				'DPD.PL'        => 'https://tracktrace.dpd.com.pl/parcelDetails?p1=%1$s',
				'Poczta Polska' => 'https://emonitoring.poczta-polska.pl/?numer=%1$s',
			),
			'Romania'             => array(
				'Fan Courier'   => 'https://www.fancourier.ro/awb-tracking/?xawb=%1$s',
				'DPD Romania'   => 'https://tracking.dpd.de/parcelstatus?query=%1$s&locale=ro_RO',
				'Urgent Cargus' => 'https://app.urgentcargus.ro/Private/Tracking.aspx?CodBara=%1$s',
			),
			'South Africa'        => array(
				'SAPO'    => 'http://sms.postoffice.co.za/TrackingParcels/Parcel.aspx?id=%1$s',
				'Fastway' => 'https://fastway.co.za/our-services/track-your-parcel?l=%1$s',
			),
			'Sweden'              => array(
				'PostNord Sverige AB' => 'https://portal.postnord.com/tracking/details/%1$s',
				'DHL.se'              => 'https://www.dhl.se/content/se/sv/express/godssoekning.shtml?AWB=%1$s&brand=DHL',
				'Bring.se'            => 'https://tracking.bring.se/tracking/%1$s',
				'UPS.se'              => 'https://www.ups.com/track?loc=sv_SE&tracknum=%1$s&requester=WT/',
				'DB Schenker'         => 'http://privpakportal.schenker.nu/TrackAndTrace/packagesearch.aspx?packageId=%1$s',
			),
			'United Kingdom (UK)' => array(
				'DHL'                       => 'http://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB=%1$s',
				'DPD'                       => 'http://www.dpd.co.uk/tracking/trackingSearch.do?search.searchType=0&search.parcelNumber=%1$s',
				'InterLink'                 => 'http://www.interlinkexpress.com/apps/tracking/?reference=%1$s&postcode=%2$s#results',
				'ParcelForce'               => 'http://www.parcelforce.com/portal/pw/track?trackNumber=%1$s',
				'Royal Mail'                => 'https://www.royalmail.com/track-your-item/?trackNumber=%1$s',
				'TNT Express (consignment)' => 'http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&respCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=%1$s&navigation=1&genericSiteIdent=',
				'TNT Express (reference)'   => 'http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=REF&respLang=en&respCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=%1$s&navigation=1&genericSiteIdent=',
				'UK Mail'                   => 'https://old.ukmail.com/ConsignmentStatus/ConsignmentSearchResults.aspx?SearchType=Reference&SearchString=%1$s',
				'DPD.co.uk'                 => 'https://www.dpd.co.uk/apps/tracking/?reference=%1$s#results',
				'DHL Parcel UK'             => 'https://track.dhlparcel.co.uk/?con=%1$s',
			),
			'United States (US)'  => array(
				'Fedex'         => 'https://www.fedex.com/Tracking?action=track&tracknumbers=%1$s',
				'FedEx Sameday' => 'https://www.fedexsameday.com/fdx_dotracking_ua.aspx?tracknum=%1$s',
				'OnTrac'        => 'http://www.ontrac.com/trackingdetail.asp?tracking=%1$s',
				'UPS'           => 'https://www.ups.com/track?loc=en_US&tracknum=%1$s',
				'USPS'          => 'https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=%1$s',
				'DHL US'        => 'https://www.logistics.dhl/us-en/home/tracking/tracking-ecommerce.html?tracking-id=%1$s',
			),
		);

In the following example we’re going to expand the France providers from a single provider to several. As with any snippet this will be located in your themes functions.php. 

/**
*  Add more shipping providers from France for vendors to select from 
*/
function custom_shipping_providers( $providers ){

  $providers['France'] = array(
    'Colissimo' => 'https://www.laposte.fr/particulier/outils/suivre-vos-envois?code=%1$s',
    'Chronopost' => 'http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros=%1$s',
    'DHL France' => 'http://www.dhl.fr/publish/fr/fr/eshipping/track.high.html?pageToInclude=RESULTS&type=trackindex&brand=I&AWB=%1$s',
    'UPS' => 'http://wwwapps.ups.com/etracking/tracking.cgi?loc=fr_FR&TypeOfInquiryNumber=T&InquiryNumber1=%1$s',
    'FEDEX' => 'http://fedex.com/Tracking?ascend_header=1&clienttype=dotcomreg&cntry_code=fr&language=french&tracknumbers=%1$s',
    'TNT' => 'http://www.tnt.fr/public/suivi_colis/recherche/visubontransport.do?radiochoixrecherche=BT&bonTransport=%1$s',
    'Mondial Relay' => 'http://www.mondialrelay.fr/public/mr_suivi.aspx?cab=%1$s',
    'Lettre Suivie' => 'https://www.laposte.fr/particulier/outils/suivre-vos-envois?code=%1$s',
  );

    return $providers;
}

add_filter( 'wcv_shipping_providers_list', 'custom_shipping_providers' );

filters

Updated on April 10, 2021

Was this article helpful?