Alokai

setBasketBillingAddress

Sets the billing address of a basket.

This method communicates with the setBasketBillingAddress endpoint of the Vue Storefront API Middleware. In turn, it receives data from the updateBillingAddressForBasket or the Set billing address of a basket endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.

Signature

export declare function setBasketBillingAddress(
	props: BasketBillingAddressSetParams & {
    basketId?: string;
}
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperBaskets.Basket>;

Parameters

NameRequiredTypeDescription
propsRequiredBasketBillingAddressSetParams & { basketId?: string; }Parameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a representation of a Basket object.

Referenced Types

  • BasketBillingAddressSetParams
  • ShopperBaskets.Basket

Examples

Setting a basket billing address by BasketBillingAddressSetParams.

import { sdk } from '~/sdk.config.ts';

const body: BasketBillingAddressSetParams= {
  address1: 'address1',
};

const basket = await sdk.commerce.setBasketBillingAddress(
  'currentBasket',
  body
);

Setting billing address the same as shipping address by useAsShipping

import { sdk } from '~/sdk.config.ts';

const body: BasketBillingAddressSetParams= {
 address1: 'address1',
 useAsShipping: true
};

const basket = await sdk.commerce.setBasketBillingAddress(
  'currentBasket',
  body
);

Setting a basket billing address with custom fields (ref. [^c_.+$]) by BasketBillingAddressSetParams

import { sdk } from '~/sdk.config.ts';

const body: BasketBillingAddressSetParams= {
 address1: 'address1',
 c_faxNumber: '123456789'
};

const basket = await sdk.commerce.setBasketBillingAddress(
  'currentBasket',
  body
);

On this page