Skip to content
Last updated

Manage Warehouses

The Manage Warehouses Element gives you the ability to list, create, delete, and edit warehouses for an account.

A warehouse is the origin location from which a seller ships. This location could be a home, an office, or anywhere. At its core, a warehouse contains two essential pieces of information: a ship-from address and a return address.

Each warehouse under a seller account has a unique warehouse ID which is used by Elements and ShipEngine to keep track of where you are shipping from. As you may recall, a valid warehouse ID is required by shipments to purchase a label successfully. To learn more about warehouses, check out the full warehouse documentation.

This can be used as a stand-alone Element and/or utilized within the Account Settings Element via the Ship From Locations section.

React Component

import { ManageWarehouses, ElementsProvider } from '@shipengine/elements';
import { themeConfig } from '../themeConfig';

const tokenPath = '/path/to/token/endpoint';

const Foo = () => {
  const getToken = useCallback(() => {
    return fetch(tokenPath).then((res) => res.text());
  }, []);

  return (
    <ElementsProvider
      getToken={getToken}
      themeConfig={themeConfig}
      onError={handleError}
    >
      <ManageWarehouses.Element />
    </ElementsProvider>
  );
};

SDK

// Creates a new instance of the Elements SDK.
const elements = new ElementsSDK(getToken, {
  onError: (err: Error) => console.error(err),
  themeConfig: themeConfig,
  locale: 'en-US',
});

const manageWarehouses = elements.create('manageWarehouses');