Shopiette simplifies creating SvelteKit apps with the Shopify Storefront API, enabling you to quickly build and customize e-commerce sites. Enjoy the best of both worlds with minimal effort, saving you time and allowing you to focus on your design integration.
Soon...
get(params: CartGetParams): Promise<CartGetData['cart']>
Get cart information.
const cart = Cart.get({
id: 'gid://shopify/Cart/1'
});
name | type | default | description |
---|---|---|---|
id |
string |
undefined |
The cart's id |
type Return = Cart;
create(): Promise<CartCreateData['cartCreate']>
Create a cart.
const { cart } = Cart.create();
type Return = {
cart: Cart;
};
updateBuyer(params: CartUpdateBuyerParams): Promise<CartUpdateBuyerData['cartBuyerIdentityUpdate']>
Add or update a cart buyer identity.
const { userErrors } = Cart.updateBuyer({
cartId: 'gid://shopify/Cart/1',
customerAccessToken: 'H3fDFVT5JyB2yRLr0rNJNdBsdSqDxk7k',
email: '[email protected]'
});
name | type | default | description |
---|---|---|---|
cartId |
string |
undefined |
The cart's id |
customerAccessToken |
string |
undefined |
The customer's access token |
email |
string |
undefined |
The customer's email |
type Return = {
userErrors: UserError[];
};
addLine(params: CartAddLineParams): Promise<CartAddLineData['cartLinesAdd']>
Add a line to a cart.
const { cart, userErrors } = Cart.addLine({
cartId: 'gid://shopify/Cart/1',
productVariantId: 'gid://shopify/Variant/1',
quantity: 2
});
name | type | default | description |
---|---|---|---|
cartId |
string |
undefined |
The cart's id |
productVariantId |
string |
undefined |
The product variant's id token |
quantity |
number |
1 |
The quantity to be added to the cart |
type Return = {
cart: Cart;
userErrors: UserError[];
};
updateLines(params: CartUpdateLinesParams): Promise<CartUpdateLinesData['cartLinesUpdate']>
Update a line in a cart.
const { cart, userErrors } = Cart.addLine({
cartId: 'gid://shopify/Cart/1',
lines: [
{
id: 'gid://shopify/Line/1',
quantity: 3
}
]
});
name | type | default | description |
---|---|---|---|
cartId |
string |
undefined |
The cart's id |
lines |
Pick<Cart['lines']['edges'][0]['node'], 'id' | 'quantity'>[] |
1 |
The new lines of the cart |
type Return = {
cart: Cart;
userErrors: UserError[];
};
deleteLines(params: CartDeleteLinesParams): Promise<CartDeleteLinesData['cartLinesRemove']>
Delete a line in a cart.
const { cart, userErrors } = Cart.addLine({
cartId: 'gid://shopify/Cart/1',
lineIds: ['gid://shopify/Line/1']
});
name | type | default | description |
---|---|---|---|
cartId |
string |
undefined |
The cart's id |
lineIds |
string[] |
undefined |
The new lines of the cart |
type Return = {
cart: Cart;
userErrors: UserError[];
};
get(params: CollectionGetParams): Promise<CollectionGetData['collection']>
Get a single collection.
const collection = Collection.get({
id: 'gid://shopify/Collection/1'
});
name | type | default | description |
---|---|---|---|
id |
string |
undefined |
The collection's id |
type Return = Collection;
getAll(params: CollectionGetAllParams): Promise<CollectionGetAllData['collections']>
Get all the collections.
const collections = Collection.getAll();
type Return = {
edges: {
node: Collection;
}[];
};
get(params: CustomerGetParams): Promise<CustomerGetData['customer']>
Get customer information.
const customer = Customer.get({
accessToken: 'H3fDFVT5JyB2yRLr0rNJNdBsdSqDxk7k'
});
name | type | default | description |
---|---|---|---|
accessToken |
string |
undefined |
The customer's access token |
type Return = Customer;
create(params: CustomerCreateParams): Promise<CustomerCreateData['customerCreate']>
Create a customer.
const customer = Customer.create({
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
password: 'Password123!'
});
name | type | default | description |
---|---|---|---|
firstName |
string |
undefined |
The customer's first name |
lastName |
string |
undefined |
The customer's last name |
email |
string |
undefined |
The customer's email |
password |
string |
undefined |
The customer's password |
type Return = {
customer: Customer;
customerUserErrors: UserError[];
};
login(params: CustomerLoginParams): Promise<CustomerLoginData['customerAccessTokenCreate']>
Generate an access token in order to log in a customer.
const customer = Customer.login({
email: '[email protected]',
password: 'Password123!'
});
name | type | default | description |
---|---|---|---|
email |
string |
undefined |
The customer's email |
password |
string |
undefined |
The customer's password |
type Return = {
customerAccessToken: {
accessToken: string;
};
customerUserErrors: UserError[];
};
logout(params: CustomerLogoutParams): Promise<CustomerLogoutData['customerAccessTokenDelete']>
Expire an access token in order to log out a customer.
const { userErrors } = Customer.logout({
accessToken: 'H3fDFVT5JyB2yRLr0rNJNdBsdSqDxk7k'
});
name | type | default | description |
---|---|---|---|
accessToken |
string |
undefined |
The customer's access token |
type Return = {
deletedAccessToken: string;
deleteCustomerAccessTokenId: string;
userErrors: UserError[];
};
recover(params: CustomerRecoverParams): Promise<CustomerRecoverData['customerRecover']>
Send an email with a reset password link.
const { customerUserErrors } = Customer.recover({
email: '[email protected]'
});
name | type | default | description |
---|---|---|---|
email |
string |
undefined |
The customer's email |
type Return = {
customerUserErrors: UserError[];
};
reset(params: CustomerResetParams): Promise<CustomerResetData['customerReset']>
Reset a customer's password.
const { customerUserErrors } = Customer.reset({
password: '[email protected]',
resetUrl: 'https://yourdomain.com/account/reset/customerId/resetToken'
});
name | type | default | description |
---|---|---|---|
email |
string |
undefined |
The customer's email |
type Return = {
customerUserErrors: UserError[];
};
get(params: ProductGetParams): Promise<ProductGetData['product']>
Get a single product.
const product = Product.get({
id: 'gid://shopify/Product/1'
});
name | type | default | description |
---|---|---|---|
id |
string |
undefined |
The product's id |
type Return = Product;
getAll(params: ProductGetAllParams): Promise<ProductGetAllData['products']>
Get all the products.
const products = Product.getAll();
type Return = {
edges: {
node: Product;
}[];
};
getProducts(params: SearchGetProductsParams): Promise<SearchGetProductsData>
Search for a product.
const product = Search.getProducts({
query: 'Bottle',
first: 3
});
name | type | default | description |
---|---|---|---|
query |
string |
undefined |
The search query |
first |
number |
5 |
The number of result items |
type Return = {
products: {
edges: {
node: Product;
};
[];
};
};
get(): Promise<ShopGetData['shop']>
Get shop information.
const shop = Shop.get();
type Return = Shop;
type Cart = {
id: string;
checkoutUrl: string;
cost: {
totalAmount: Price;
};
lines: {
edges: {
node: {
id: string;
quantity: number;
merchandise: {
availableForSale: boolean;
compareAtPrice: Price | null;
id: string;
image: Image;
price: Price;
product: Product;
selectedOptions: {
name: string;
value: string;
};
[];
title: string;
};
};
};
[];
};
};
type Collection = {
id: string;
title: string;
description: string;
image: Image;
products: {
edges: {
node: Omit<Product, 'variants'>;
}[];
};
}
type Customer = {
id: string;
firstName: string;
lastName: string;
email: string;
};
type Image = {
originalSrc: string;
altText: string;
};
type Price = {
amount: string;
};
type Product = {
id: string;
title: string;
description: string;
totalInventory: number;
featuredImage: Image;
priceRange: {
maxVariantPrice: Price;
minVariantPrice: Price;
};
variants: {
edges: {
node: {
id: string;
title: string;
availableForSale: boolean;
compareAtPrice: Price | null;
price: Price;
selectedOptions: {
name: string;
value: string;
};
[];
image: Image;
product: {
id: string;
title: string;
description: string;
images: {
edges: {
node: Image;
};
[];
};
};
};
};
[];
};
};
type Shop = {
name: string;
brand: {
logo: {
image: Image;
};
};
};
type UserError {
field: string;
message: string;
}
Made with ❤️ by Bado.
Copyright © 2024 Baptiste Dauphouy