What can we help you with?

Step by Step Guide to Integrate ELEX WooCommerce Shipsurance Add-On with Any WooCommerce Shipping Plugins

This article explains the step-by-step guide to integrate ELEX Shipsurance Add-On with any WooCommerce shipping plugins. For more information on the add-on, refer to the product page.

If you want to integrate ELEX WooCommerce Shipsurance Add-On on your shipping plugin, you have to do some steps of settings on the back end. 

For that, you have to determine at which point your Shipping plugin should send a request to Shipsurance to get insured the particular order. Mostly, this action should be triggered when the shop owner initiates the shipment. 

Step 1: Send a Request to Shipsurance for the Insurance Coverage.

Decide when you want to send the request to Shipsurance. Go to the backend of your plugin and add the below code.


               $request_parameters = array(


                   'tracking_ids'=> $tracking_ids_string, // tracking ids in comma seperated format.  

                   'shipmentDate' =>  date('m/d/Y'),

                   'departureCountry' => 'US', // Replace it with relevant Country code. 

                   'extCarrierId' => 1,   // 1  => USPS  

                   'extShipmentTypeId' => 1 ); // 1 => Parcel , 2 => Cargo/Freight  

               do_action('elex_shipsurance_dsi_record_shipment', $request_parameters );
  • Here $tracking_ids_string is a variable for tracking ID. If there are multiple tracking IDs, you can declare it as a string and add values separated by a comma.
  • $post_id is a variable for an order ID.
  • For  ‘departureCountry’ , you can give your respective departure country. Here in the code, it is the US. 
  • ‘extCarrierId’ is a variable for adding the corresponding value for the shipping service that your plugin provides. Here the value for USPS is 1. You can find the ID for your required shipping service from https://shipsurance-partner-api.readme.io/password?redirect=/docs/extcarrierid-lookup. You should register to Shipsurance for getting the password for taking the corresponding ID for the shipping service.

Step2: Returning Shipsurance Reference Number. 

For returning Shipsurance unique reference number for displaying it on your store, use the below code:

$shipsurance_policy_reference_number = get_post_meta($post_id,'elex_shipsurance_policy_reference_number');   

Step 3: Cancelling Insurance.

While a particular order cancels, the coverage should be canceled. For that, add the below code when you want to send the cancellation request to Shipsurance.

  $request_parameters = array(
       do_action('elex_shipsurance_void_record_shipment', $request_parameters );

To Wrap Up,

You can make the changes to the code with respect to the shipping methods you are using for your  WooCommerce store and the variables you are already using. 


You must be logged in to post a comment.