Wednesday 7 June 2017

WooCommerce Shipment Tracking 1.6.7 Extension


WooCommerce Shipment Tracking 1.6.7 Extension

Get it now



Add shipment tracking information to your orders

With the Shipment Tracking extension you can provide customers with an easy way to track their shipments.







Tracking info on the frontend

After adding details to an order, the tracking information will appear in emails, the order tracking page, and the order view page in their account section. For the best effect, add tracking info just before ‘completing’ an order.

Shipment Tracking

The Shipment Tracking extension provides customers with an easy way to track shipments by adding a link to emails and order pages.
Adds shipment tracking to emails sent to the customer (e.g., Completed Order email).

Installation

  1. Ensure you have latest version of WooCommerce installed
  2. Unzip and upload the plugin’s folder to your /wp-content/plugins/ directory
  3. Activate the extension through the ‘Plugins’ menu in WordPress

Adding tracking information to orders

Please note: the shipment tracking details are added to the “completed order” email once the order status is marked as completed.
On the edit/view order screen, you will see a new write panel for shipment information:







Adding Order Shipment Tracking
Adding Order Shipment Tracking

To add shipment information for the customer to view:







Shipment Tracking Details
Shipment Tracking Details

  1. Choose a provider. This should be the shipping company you use. If your provider is not listed, choose the Custom Provider option.
  2. Add the tracking number that the provider assigned. If you chose the custom option, you need to enter the full link to the company’s tracking page (if applicable).
  3. Choose a shipping date (optional), which is when the package was shipped.
  4. (optional) Test the preview link to see if it works as you expect.
  5. Save the order. This is also a good time to change the order status to Complete. The customer will then receive an email with tracking code.
  6. (optional) Add additional tracking numbers by selecting Add Tracking Number.

Custom Meta Reference

The Shipping Tracking plugin stores the tracking information in the order meta with the meta key _wc_shipment_tracking_items. It’s an array with the following structure:
  • tracking_provider — String of predefined provider
  • custom_tracking_provider — String of custom provider
  • custom_tracking_link — String of custom tracking URL
  • tracking_number — String of tracking number
  • date_shipped — Timestamp of shipment date
Developers can use the helper function wc_st_add_tracking_number to add tracking info to an order. In this helper function the field $custom_url is optional.
Example usage:
if ( function_exists( 'wc_st_add_tracking_number' ) ) {
wc_st_add_tracking_number( $order_id, $tracking_number, $provider, $date_shipped, $custom_url );
}
view rawexample.php hosted with ❤ by GitHub

Customization

Changing the default shipment provider

Note: This is a Developer level section. If you are unfamiliar with code and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.
The plugin provides a hook for changing the default provider from ‘custom’ called ‘woocommerce_shipment_tracking_default_provider’. This can be used by adding a custom function to your theme functions.php file and passing back the name of the provider, which should be the default:
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;
}
view rawgistfile1.txt hosted with ❤ by GitHub

Add Custom Providers Dynamically

You can add custom providers dynamically by using this snippet in functions.php in your theme folder:
<?php
add_action( 'wc_shipment_tracking_get_providers' , 'wc_shipment_tracking_add_custom_provider' );
/**
* wc_shipment_tracking_add_custom_provider
*
* Adds custom provider to shipment tracking
* Change the country name, the provider name, and the URL (it must include the %1$s)
* Add one provider per line
*/
function wc_shipment_tracking_add_custom_provider( $providers ) {
$providers['France']['Provider Name 1'] = 'http://url.com?id=%1$s';
$providers['Ireland']['Provider name 2'] = 'http://url.com?id=%1$s';
// etc...
return $providers;
}
view rawgistfile1.php hosted with ❤ by GitHub

REST API Support

Version 1.5+ support the REST API







Shipment Tracking REST API

The shipment tracking REST API allows you to create, view, and delete individual shipment tracking. The endpoint is /wp-json/wc/v1/orders/shipment-trackings.

Shipment Tracking Properties

ATTRIBUTETYPEDESCRIPTION
tracking_idstringUnique identifier for shipment trackingread-only
tracking_numberstringTracking numberrequired
tracking_providerstringTracking provider name
tracking_linkurlTracking link
date_shippeddateDate when package was shipped

Create a shipment tracking

POST /wp-json/wc/v1/orders/<order_id>/shipment-trackings
If predefined provider name is used, then no need to pass tracking_link.
curl -X POST https://example.com/wp-json/wc/v1/orders/645/shipment-trackings \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "tracking_provider": "TNT Express (consignment)",
  "tracking_number": "12345678",
}'
JSON response example:
{
  "tracking_id": "7f4978c390ee633c6294ae0f258656f9",
  "tracking_provider": "TNT Express (consignment)",
  "tracking_link": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=12345678&navigation=1&g\nenericSiteIdent=",
  "tracking_number": "12345678",
  "date_shipped": "2016-08-11",
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497/shipment-trackings/7f4978c390ee633c6294ae0f258656f9"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497/shipment-trackings"
      }
    ],
    "up": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497"
      }
    ]
  }
}
Using custom provider:
curl -X POST https://example.com/wp-json/wc/v1/orders/645/shipment-trackings \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "custom_tracking_provider": "Custom",
  "custom_tracking_link": "https://example.com?q=%1$s",
  "tracking_number": "12345678"
}'

Retrieve a shipment tracking

GET /wp-json/wc/v1/orders/<order_id>/shipment-trackings/<tracking-id>
curl -X GET https://example.com/wp-json/wc/v1/orders/645/shipment-trackings/7f4978c390ee633c6294ae0f258656f9 \
    -u consumer_key:consumer_secret \
JSON response example:
{
  "tracking_id": "7f4978c390ee633c6294ae0f258656f9",
  "tracking_provider": "TNT Express (consignment)",
  "tracking_link": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=12345678&navigation=1&g\nenericSiteIdent=",
  "tracking_number": "12345678",
  "date_shipped": "2016-08-11",
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497/shipment-trackings/7f4978c390ee633c6294ae0f258656f9"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497/shipment-trackings"
      }
    ],
    "up": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497"
      }
    ]
  }
}

List all shipment trackings

GET /wp-json/wc/v1/orders/<order_id>/shipment-trackings/
curl -X GET https://example.com/wp-json/wc/v1/orders/645/shipment-trackings \
    -u consumer_key:consumer_secret \
JSON response example:
[
  {
    "tracking_id": "c8ce8278b1e6ddc93b1b465992bac886",
    "tracking_provider": "TNT Express (consignment)",
    "tracking_link": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=12345678&navigation=1&g\nenericSiteIdent=",
    "tracking_number": "12345678",
    "date_shipped": "2016-08-10",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v1/orders/4497/shipment-trackings/c8ce8278b1e6ddc93b1b465992bac886"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v1/orders/4497/shipment-trackings"
        }
      ],
      "up": [
        {
          "href": "https://example.com/wp-json/wc/v1/orders/4497"
        }
      ]
    }
  }
]

Delete a shipment tracking

DELETE /wp-json/wc/v1/orders/<order_id>/shipment-trackings/<tracking-id>
curl -X DELETE https://example.com/wp-json/wc/v1/orders/645/shipment-trackings/c8ce8278b1e6ddc93b1b465992bac886 \
    -u consumer_key:consumer_secret \
JSON response example:

  "tracking_id": "c8ce8278b1e6ddc93b1b465992bac886",
  "tracking_provider": "TNT Express (consignment)",
  "tracking_link": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=CON&respLang=en&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=12345678&navigation=1&g\nenericSiteIdent=",
  "tracking_number": "12345678",
  "date_shipped": "2016-08-10",
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497/shipment-trackings/c8ce8278b1e6ddc93b1b465992bac886"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497/shipment-trackings"
      }
    ],
    "up": [
      {
        "href": "https://example.com/wp-json/wc/v1/orders/4497"
      }
    ]
  }
}

List all shipment tracking providers

GET /wp-json/wc/v1/orders/<order_id>/shipment-trackings/providers
curl -X GET https://example.com/wp-json/wc/v1/orders/645/shipment-trackings/providers \
    -u consumer_key:consumer_secret \
JSON response example:
{
  "Australia": {
    "Australia Post": "http://auspost.com.au/track/track.html?id=%1$s",
    "Fastway Couriers": "http://www.fastway.com.au/courier-services/track-your-parcel?l=%1$s"
  },
  "Austria": {
    "post.at": "http://www.post.at/sendungsverfolgung.php?pnum1=%1$s",
    "dhl.at": "http://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": {
    "Correios": "http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=%1$s"
  },
  "Canada": {
    "Canada Post": "http://www.canadapost.ca/cpotools/apps/track/personal/findByTrackNumber?trackingNumber=%1$s"
  },
  "Czech Republic": {
    "PPL.cz": "http://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": "http://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": {
    "Itella": "http://www.posti.fi/itemtracking/posti/search_by_shipment_id?lang=en&ShipmentId=%1$s"
  },
  "France": {
    "Colissimo": "http://www.colissimo.fr/portail_colissimo/suivre.do?language=fr_FR&colispart=%1$s"
  },
  "Germany": {
    "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.de": "https://tracking.dpd.de/parcelstatus?query=%1$s&locale=en_DE"
  },
  "Ireland": {
    "DPD.ie": "http://www2.dpd.ie/Services/QuickTrack/tabid/222/ConsignmentID/%1$s/Default.aspx",
    "An Post": "https://track.anpost.ie/TrackingResults.aspx?rtt=1&items=%1$s"
  },
  "Italy": {
    "BRT (Bartolini)": "http://as777.brt.it/vas/sped_det_show.hsm?referer=sped_numspe_par.htm&Nspediz=%1$s",
    "DHL Express": "http://www.dhl.it/it/express/ricerca.html?AWB=%1$s&brand=DHL"
  },
  "India": {
    "DTDC": "http://www.dtdc.in/dtdcTrack/Tracking/consignInfo.asp?strCnno=%1$s"
  },
  "Netherlands": {
    "PostNL": "https://mijnpakket.postnl.nl/Claim?Barcode=%1$s&Postalcode=%2$s&Foreign=False&ShowAnonymousLayover=False&CustomerServiceClaim=False",
    "DPD.NL": "http://track.dpdnl.nl/?parcelnumber=%1$s"
  },
  "New Zealand": {
    "Courier Post": "http://trackandtrace.courierpost.co.nz/Search/%1$s",
    "NZ Post": "http://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"
  },
  "South African": {
    "SAPO": "http://sms.postoffice.co.za/TrackingParcels/Parcel.aspx?id=%1$s"
  },
  "Sweden": {
    "Posten AB": "http://www.posten.se/sv/Kundservice/Sidor/Sok-brev-paket.aspx?search=%1$s",
    "DHL.se": "http://www.dhl.se/content/se/sv/express/godssoekning.shtml?brand=DHL&AWB=%1$s",
    "Bring.se": "http://tracking.bring.se/tracking.html?q=%1$s",
    "UPS.se": "http://wwwapps.ups.com/WebTracking/track?track=yes&loc=sv_SE&trackNums=%1$s",
    "DB Schenker": "http://privpakportal.schenker.nu/TrackAndTrace/packagesearch.aspx?packageId=%1$s"
  },
  "United Kingdom": {
    "DHL": "http://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB=%1$s",
    "DPD.co.uk": "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&\nrespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=%1$s&navigation=1&g\nenericSiteIdent=",
    "TNT Express (reference)": "http://www.tnt.com/webtracker/tracking.do?requestType=GEN&searchType=REF&respLang=en&r\nespCountry=GENERIC&sourceID=1&sourceCountry=ww&cons=%1$s&navigation=1&gen\nericSiteIdent=",
    "UK Mail": "https://old.ukmail.com/ConsignmentStatus/ConsignmentSearchResults.aspx?SearchType=Reference&SearchString=%1$s"
  },
  "United States": {
    "Fedex": "http://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": "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=%1$s",
    "USPS": "https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=%1$s"
  }
}
WooCommerce Shipment Tracking 1.6.7 Extension

Get it now


http://getlot.co/shop/woocommerce-shipment-tracking-extension/

0 Comments:

Post a Comment

Note: only a member of this blog may post a comment.

Subscribe to Post Comments [Atom]

<< Home