selectActions$(): Observable<TBasketActions>¶
The selectActions$
method allows to select a key value object with various basket actions.
Returned value¶
A returned value has a type of Observable<TBasketActions> representing an object with basket actions inside.
Example¶
In this example we make a basketOverallApi
call to select an action for changing a billing address in order to set its new value. We also use a getBillingAddress method from Basket Overall API API to get the action for setting the billing address with the retrieved action.
useStorefront(async (storefront) => {
const basketAddressesApi = storefront.getApiSync('basketAddressesApi');
const basketOverallApi = storefront.getApiSync('basketOverallApi');
let changeBillingAddressAction;
basketOverallApi.selectActions$().subscribe((basketActions) => {
changeBillingAddressAction = basketActions.changeBillingAddress;
});
await basketAddressesApi.setBillingAddress(changeBillingAddressAction, {
isCompany: false,
companyName: '',
firstName: 'John',
lastName: 'Snow',
personalIdNumber: '',
taxId: '',
countryId: 'US',
city: 'My City',
postalCode: '12-345',
street: 'example street 8',
street2: '',
phone: '123456789',
state: '',
useAsBillingAddress: false,
createUserAccount: false
});
});
Basket Overall API methods reference¶
- getActions
- getId
- selectId$
- getComment
- selectComment$
- getIsVatEu
- selectIsVatEu$
- getDelivery
- selectDelivery$
- getSum
- selectSum$
- getSumWithoutPaymentAndShipping
- selectSumWithoutPaymentAndShipping$
- cleanBasket
- setComment
- getInvalidSections
- selectInvalidSections$
- getSectionValidation
- selectSectionValidation$