• Hi everyone,

    I’m running a ecommerce site on Woocommerce 2.4.7 plugin, and with the Flatsome child theme.

    Up till now, I have been doing this myself using help from online forums and plugins to pull this off.

    The thing now is that my courier service has an API which needs to be inserted into the store code. I’m a bit lost as to how to do this as I’m not exactly a programmer. This is the code which needs to be inserted. Any help will be greatly appreciated.

    $url = 'http://cs.maxcellents.com.sg/max_api.php';
    
     $fields = array( 'userid' => urlencode('User ID'),
    
     'password' => urlencode('Password'), 
    
     'Name' => urlencode('Name'), 
    
     'Address' => urlencode('Address'), 
    
     'Postal' => urlencode('Postal'), 
    
     'Telephone' => urlencode('Contact'), 
    
     'Email' => urlencode('Email'), 
    
     'Remark' => urlencode('Remarks'), 
    
     'value' => urlencode('Parcel Value') ); 
    
     foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } 
    
     rtrim($fields_string, '&'); 
    
     $ch = curl_init(); 
    
     curl_setopt($ch,CURLOPT_URL, $url); 
    
     curl_setopt($ch,CURLOPT_POST, count($fields)); 
    
     curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); 
    
     $result = curl_exec($ch); 
    
     $trackin = json_decode($result, true); 
    
     if (isset($trackin["error"])) 
    
     { 
    
     //handle error 
    
     } 
    
     if (isset($trackin["trackNumber"])) 
    
     { 
    
     //handle tracking number 
    
     } 
    
     curl_close($ch);

    https://wordpress.org/plugins/woocommerce/

The topic ‘Help inserting courier API’ is closed to new replies.