---
title: Store'lar
description: Eski headless tema altyapısındaki (@ikas/storefront) IkasBaseStore, IkasCartStore ve IkasCustomerStore referansı.
---

<Callout type="warn" title="Eski altyapı">
Bu sayfa, ikas Studio öncesindeki headless tema altyapısının (`@ikas/storefront`) referansıdır. Yeni temalar için [ikas Studio](https://builders.ikas.com/docs/ikas-studio) dokümantasyonunu kullanın.
</Callout>

Store'lar, temanın global durumunu (sepet, müşteri, sayfa bilgisi) yöneten MobX tabanlı singleton yapılardır. Store'lara `IkasBaseStore.getInstance()` üzerinden erişilir; sepet ve müşteri store'ları bu instance'ın `cartStore` ve `customerStore` field'larında bulunur.

## IkasBaseStore [#ikas-base-store]

| Field | Tip | Açıklama |
| --- | --- | --- |
| `customerStore` | `IkasCustomerStore` | Bkz. [IkasCustomerStore](https://builders.ikas.com/docs/headless-theme/api/stores#ikas-customer-store). |
| `cartStore` | `IkasCartStore` | Bkz. [IkasCartStore](https://builders.ikas.com/docs/headless-theme/api/stores#ikas-cart-store). |
| `currentPageType` | `IkasThemeJsonPageType \| null \| undefined` | Merchant'ın şu anda hangi sayfada olduğunu öğrenmeniz gerekiyorsa bu field'ı kullanabilirsiniz. Bkz. [IkasThemeJsonPageType](https://builders.ikas.com/docs/headless-theme/api/enums#ikas-theme-json-page-type). |
| `localeOptions` | `IkasLocaleOption[]` | Storefront için kullanılabilir dil ve bölge seçenekleri. Bkz. [IkasLocaleOption](https://builders.ikas.com/docs/headless-theme/api/storefront-and-settings#ikas-locale-option). |
| `showLocaleOptions` | `boolean` | `localeOptions` listesinin müşteriye gösterilip gösterilmeyeceğini belirtir. Bu genellikle müşterinin, kendisine özel dil veya fiyatlandırma tanımlı bir ülkeden geldiği anlamına gelir (`isRecommended=true` olan localeOption). |
| `currentCountryCode` | `string \| null \| undefined` | Müşterinin ziyaret ettiği ülkenin ISO2 kodu. |

### getInstance [#ikas-base-store-get-instance]

Singleton `IkasBaseStore` instance'ına erişmeyi sağlayan fonksiyon.

```typescript
function getInstance(): getInstance
```

## IkasCartStore [#ikas-cart-store]

| Field | Tip | Açıklama |
| --- | --- | --- |
| `cart` | `IkasCart \| null \| undefined` | Bkz. [IkasCart](https://builders.ikas.com/docs/headless-theme/api/cart-and-orders#ikas-cart). |
| `isLoadingCart` | `boolean` | - |
| `isCartLoadFinished` | `boolean` | - |
| `checkoutId` | `boolean` | - |
| `checkoutUrl` | `boolean` | - |

### addItem [#ikas-cart-store-add-item]

Sepete yeni bir ürün ekler. Sepet yoksa yeni bir sepet oluşturulur.

```typescript
async addItem( variant: IkasProductVariant, product: IkasProduct, initialQuantity = 1 )
```

| Parametre | Tip |
| --- | --- |
| `variant` | `IkasProductVariant` |
| `product` | `IkasProduct` |
| `initialQuantity` | `number` |

### changeItemQuantity [#ikas-cart-store-change-item-quantity]

Sepetteki bir ürünün adedini verilen değerle günceller.

```typescript
async changeItemQuantity( item: IkasOrderLineItem, quantity: number )
```

| Parametre | Tip |
| --- | --- |
| `item` | `IkasOrderLineItem` |
| `quantity` | `number` |

### removeItem [#ikas-cart-store-remove-item]

Verilen ürünü sepetten çıkarır.

```typescript
async removeItem(item: IkasOrderLineItem)
```

| Parametre | Tip |
| --- | --- |
| `item` | `IkasOrderLineItem` |

### findExistingItem [#ikas-cart-store-find-existing-item]

Sepetteki ürünler arasından eşleşen kaydı bulur. Ürün seçeneklerini (product option) de hesaba kattığı için sepet dizisinde elle arama yapmak yerine bu fonksiyonu kullanmanız önerilir.

```typescript
async findExistingItem(variant: IkasProductVariant, product: IkasProduct)
```

| Parametre | Tip |
| --- | --- |
| `variant` | `IkasProductVariant` |
| `product` | `IkasProduct` |

### removeCart [#ikas-cart-store-remove-cart]

Mevcut sepeti kaldırır.

```typescript
removeCart()
```

### saveCart [#ikas-cart-store-save-cart]

Ürün ekleme ve çıkarma gibi olağan sepet işlemlerinde bu fonksiyona ihtiyaç duymazsınız. Daha gelişmiş senaryolarda sepeti kaydetmek için kullanabilirsiniz.

```typescript
async saveCart(cart: IkasCart)
```

| Parametre | Tip |
| --- | --- |
| `cart` | `IkasCart` |

### getCart [#ikas-cart-store-get-cart]

Sepet verisi cartStore içinde otomatik olarak çekilir; bu fonksiyon daha gelişmiş senaryolar için sunulur. Çağrıldığında cartStore'daki `cart` field'ını günceller.

```typescript
async getCart()
```

### saveCouponCode [#ikas-cart-store-save-coupon-code]

Sepete kupon kodu uygular. `null` gönderildiğinde kupon kodu temizlenir.

```typescript
async saveCouponCode(couponCode?: string | null)
```

| Parametre | Tip |
| --- | --- |
| `couponCode` | `string \| null` |

### removeCouponCode [#ikas-cart-store-remove-coupon-code]

Sepetteki kupon kodunu kaldırır.

```typescript
async removeCouponCode()
```

### waitUntilInitialized [#ikas-cart-store-wait-until-initialized]

Cart store'un başlatılmasını beklemek için bu fonksiyonu kullanın. Sepet varsa `cart` field'ı doldurulur.

```typescript
waitUntilInitialized()
```

## IkasCustomerStore [#ikas-customer-store]

| Field | Tip | Açıklama |
| --- | --- | --- |
| `customer` | `IkasCustomer \| null \| undefined` | Bkz. [IkasCustomer](https://builders.ikas.com/docs/headless-theme/api/customers#ikas-customer). |
| `initialized` | `boolean` | Store başarıyla başlatıldıysa `true` olur. |
| `customerConsentGranted` | `boolean` | Müşteri çerezleri kabul ettiyse `true` olur. |
| `isCaptchaRequired` | `boolean` | Bazı işlemler captcha doğrulaması gerektirebilir. Merchant, captcha kullanıp kullanmayacağını ikas panelinden seçer; captcha kullanmayı tercih ettiyse bu field `true` döner. |

### socialLogin [#ikas-customer-store-social-login]

Müşteriyi ilgili sağlayıcının URL'sine yönlendirerek sosyal giriş akışını başlatır.

```typescript
async socialLogin(provider: "facebook" | "google")
```

| Parametre | Tip |
| --- | --- |
| `provider` | `"facebook" \| "google"` |

### socialLoginToken [#ikas-customer-store-social-login-token]

Sosyal giriş sağlayıcısından alınan token ile oturum açar.

```typescript
async socialLoginToken(token: string)
```

| Parametre | Tip |
| --- | --- |
| `token` | `string` |

### refundOrder [#ikas-customer-store-refund-order]

Verilen sipariş için iade talebi oluşturur.

```typescript
async refundOrder(order: IkasOrder)
```

| Parametre | Tip |
| --- | --- |
| `order` | `IkasOrder` |

### login [#ikas-customer-store-login]

E-posta ve şifre ile müşteri oturumu açar.

```typescript
async login(email: string, password: string)
```

| Parametre | Tip |
| --- | --- |
| `email` | `string` |
| `password` | `string` |

### logout [#ikas-customer-store-logout]

Müşterinin oturumunu kapatır.

```typescript
logout()
```

### register [#ikas-customer-store-register]

Yeni bir müşteri hesabı oluşturur. İsteğe bağlı olarak pazarlama izni ve müşteri özellikleri (customer attribute) de gönderilebilir.

```typescript
async register( firstName: string, lastName: string, email: string, password: string, isMarketingAccepted?: boolean, attributes?: IkasCustomerAttributeValue[] )
```

| Parametre | Tip |
| --- | --- |
| `firstName` | `string` |
| `lastName` | `string` |
| `email` | `string` |
| `password` | `string` |
| `isMarketingAccepted` | `boolean \| undefined` |
| `attributes` | `IkasCustomerAttributeValue[] \| undefined` |

### saveContactForm [#ikas-customer-store-save-contact-form]

İletişim formunu kaydeder.

```typescript
async saveContactForm(input: IkasContactForm)
```

| Parametre | Tip |
| --- | --- |
| `input` | `IkasContactForm` |

### checkEmail [#ikas-customer-store-check-email]

Verilen e-posta adresinin kullanılıp kullanılmadığını kontrol eder.

```typescript
async checkEmail(email: string)
```

| Parametre | Tip |
| --- | --- |
| `email` | `string` |

### forgotPassword [#ikas-customer-store-forgot-password]

Verilen e-posta adresine şifre sıfırlama bağlantısı gönderir.

```typescript
async forgotPassword(email: string)
```

| Parametre | Tip |
| --- | --- |
| `email` | `string` |

### recoverPassword [#ikas-customer-store-recover-password]

Şifre sıfırlama bağlantısındaki token ile müşterinin şifresini yeniler.

```typescript
async recoverPassword(password: string, passwordAgain: string, token: string)
```

| Parametre | Tip |
| --- | --- |
| `password` | `string` |
| `passwordAgain` | `string` |
| `token` | `string` |

### saveCustomer [#ikas-customer-store-save-customer]

Müşteri bilgilerini günceller.

```typescript
async saveCustomer(customer: IkasCustomer)
```

| Parametre | Tip |
| --- | --- |
| `customer` | `IkasCustomer` |

### getOrders [#ikas-customer-store-get-orders]

Oturum açmış müşterinin siparişlerini listeler.

```typescript
async getOrders()
```

### getOrder [#ikas-customer-store-get-order]

id ile belirli bir müşteri siparişini getirir.

```typescript
async getOrder(id: string)
```

### getOrderByEmail [#ikas-customer-store-get-order-by-email]

E-posta adresi ve sipariş numarasıyla belirli bir müşteri siparişini getirir.

```typescript
async getOrderByEmail(email: string, orderNumber: string)
```

### getOrderTransactions [#ikas-customer-store-get-order-transactions]

Bir siparişin ödeme işlemlerini (transaction) getirir.

```typescript
async getOrderTransactions(params: { checkoutId?: string; id?: string; orderId?: string; } = {})
```

| Parametre | Tip |
| --- | --- |
| `params` | `{checkoutId?: string; id?: string; orderId?: string;}` |

### getFavoriteProductsIds [#ikas-customer-store-get-favorite-products-ids]

Müşterinin favori ürünlerinin id'lerini getirir.

```typescript
async getFavoriteProductsIds()
```

### getFavoriteProducts [#ikas-customer-store-get-favorite-products]

Müşterinin favori ürünlerini getirir.

```typescript
async getFavoriteProducts()
```

### addProductToFavorites [#ikas-customer-store-add-product-to-favorites]

Ürünü müşterinin favorilerine ekler.

```typescript
async addProductToFavorites(productId: string)
```

### removeProductFromFavorites [#ikas-customer-store-remove-product-from-favorites]

Ürünü müşterinin favorilerinden çıkarır.

```typescript
async removeProductFromFavorites(productId: string)
```

### isProductFavorite [#ikas-customer-store-is-product-favorite]

Ürünün müşterinin favorilerinde olup olmadığını kontrol eder.

```typescript
async isProductFavorite(productId: string)
```

### createEmailSubscription [#ikas-customer-store-create-email-subscription]

E-bülten ve pazarlama bildirimlerine abone olur.

```typescript
async createEmailSubscription(email: string)
```

### sendReview [#ikas-customer-store-send-review]

Bir ürün için müşteri yorumu gönderir.

```typescript
async sendReview(input: IkasCustomerReviewForm)
```

### onCustomerConsentGrant [#ikas-customer-store-on-customer-consent-grant]

Müşteri çerezleri kabul ettiğinde çağrılması gereken callback.

```typescript
onCustomerConsentGrant()
```

### waitUntilInitialized [#ikas-customer-store-wait-until-initialized]

Customer store'un başlatılmasını beklemek için bu fonksiyonu kullanın. Müşteri oturum açmışsa `customer` field'ı doldurulur.

```typescript
waitUntilInitialized()
```

### waitUntilCaptchaTokenInitialized [#ikas-customer-store-wait-until-captcha-token-initialized]

Captcha token'ının hazır olmasını bekler. Captcha gerektiren işlemlerden önce kullanın.

```typescript
waitUntilCaptchaTokenInitialized()
```

### getCustomerAttributes [#ikas-customer-store-get-customer-attributes]

Mağazada tanımlı müşteri özelliklerini (customer attribute) getirir.

```typescript
async getCustomerAttributes()
```
