wpdesk/ups-shipping-service


README

pipeline status coverage report Latest Stable Version Total Downloads Latest Unstable Version License

UPS Shipping Service

A library which implements https://gitlab.com/wpdesk/predators/library/abstract-shipping and uses the UPS API connection to obtain the UPS shipping live rates in return.

Requirements

PHP 7.0 or later.

Installation via Composer

In order to install the bindings via Composer run the following command:

composer require wpdesk/ups-shipping-service

Example usage

Obtain the UPS rates for shipment

<?php
/*
 * @see https://gitlab.com/wpdesk/predators/library/abstract-shipping#creating-shipment-from-woocommerce-cart-contents
 */
$shipment = create_shipment(); 

$service_settings = new \WPDesk\AbstractShipping\Settings\SettingsValuesAsArray([
    'user_id' => 'Your UPS user ID',
    'password' => 'Your UPS password',
    'access_key' => 'Your UPS access key',
    'account_number' => 'Your UPS acount number',
]);

$rates = $service->rate_shipment($service_settings, $shipment);
print_r( $rates );