@selldone/sdk-storefront
Version:
A TypeScript SDK to connect to your shop and build a fully functional storefront and website by simply developing a frontend web application. All backend operations are seamlessly managed by the serverless Selldone solution.
38 lines (37 loc) • 1.52 kB
TypeScript
import { Currency } from "@selldone/core-js/enums/payment/Currency";
import { XapiBasket } from "../XapiBasket";
import { Basket } from "@selldone/core-js/index";
/**
* Deletes an item from the basket.
*
* This function is used to remove a specified product variant from the basket.
*
* @param {number} product_id - The ID of the product to be deleted.
* @param {number | null} variant_id - The ID of the product variant, or null if not applicable.
* @param {XapiBasketDeleteItemTypes.IOption} [options] - Optional parameters for deleting the item.
* @returns {Promise<XapiBasketDeleteItemTypes.IResponse>} - The response from the server after attempting to delete the item.
*
* @example
* window.$storefront.basket
* .deleteItem(product_id, variant_id)
* .then(({ basket, bill }) => {
* this.setBasket(basket);
* this.setBasketBill(basket, bill);
* if (callbackSuccess) callbackSuccess(basket);
* })
* .catch((error) => {
* NotificationService.showLaravelError(error);
* if (callbackError) callbackError(error);
* });
*/
export default function XapiBasketDeleteItem(this: XapiBasket, product_id: number, variant_id: number | null, options?: XapiBasketDeleteItemTypes.IOption): Promise<XapiBasketDeleteItemTypes.IResponse>;
export declare namespace XapiBasketDeleteItemTypes {
interface IResponse {
success: boolean;
basket: Basket;
bill: Basket.ICalculatedBill;
}
interface IOption {
currency?: keyof typeof Currency;
}
}