← Files WixARCHIVED FILE
skills/wix-app/references/stores/WRITE.md
1.48 KB · Oct 8, 2026 · 12:02 UTC
# Stores — Write Operations (Create / Update / Delete)
## Create a product (single-variant, with price)
```typescript
if (v === 'V3_CATALOG') {
const product = await productsV3.createProduct({
name: 'My Product',
productType: 'PHYSICAL', // UPPER_CASE
variantsInfo: {
variants: [{
price: { actualPrice: { amount: '19.99' } }, // string, on the variant
sku: 'SKU-001',
}],
},
});
return product;
}
const { product } = await products.createProduct({
name: 'My Product',
productType: 'physical', // lower-case
priceData: { price: 19.99 }, // number, on the product
sku: 'SKU-001',
});
return product;
```
---
## Update a product (V3 needs `revision`)
```typescript
if (v === 'V3_CATALOG') {
// Signature: updateProduct(_id, productFields). Returns V3Product directly.
const current = await productsV3.getProduct(id);
if (current.revision == null) throw new Error(`Product ${id} has no revision`);
return await productsV3.updateProduct(id, {
revision: current.revision, // narrowed — required under exactOptionalPropertyTypes
name: 'New name',
});
}
// V1: updateProduct(id, productFields). Returns { product }.
const { product } = await products.updateProduct(id, { name: 'New name' });
return product;
```
---
## Delete a product
```typescript
if (v === 'V3_CATALOG') await productsV3.deleteProduct(id);
else await products.deleteProduct(id);
```
SHA-256: e3c80de7a966983a9fb4aa70f7e5ee52db475a529950184e5369702521d9bb70