### Buy X Get Y Offer Example
Source: https://docs.salla.dev/5394218e0
An example of a 'buy X get Y' offer where customers buy a specific quantity of a product and receive a percentage discount on additional items. Includes detailed product information.
```yaml
- id: 760467012
name: complex
message: >-
اشتري 20 pieces واحصل على 10 pieces خصم 20% من المنتجات
التالية
expiry_date: '2022-01-22 00:00:00'
start_date: null
offer_type: buy_x_get_y
status: inactive
show_price_after_discount: null
show_discounts_table_message: false
applied_to: product
buy:
type: product
quantity: 20
products:
- id: 1414899111
sku: Mon1234
name: الموناليزا
price: 108
currency: SAR
description:
الموناليزا تيست تيست
options: ''
type: product
store_id: 4934
brand_id: 0
quantity: 0
status: out
rand_token: ''
views: 0
created_at: '2022-01-04T06:51:30.000000Z'
updated_at: '2022-12-31T12:45:25.000000Z'
minimum_order_time: '0'
maximum_daily_order: null
maximum_quantity_per_order: null
allow_attachments: 0
pinned: 0
pinned_date: '2022-01-04 09:51:30'
sale_price: 0
sale_end: null
source: '24'
require_shipping: 1
cost_price: 15001
digital_download_limit: null
digital_download_expiry: null
from_instagram: 0
weight: null
with_tax: true
hide_quantity: false
min_amount_donating: 0
max_amount_donating: 0
subtitle: null
active_advance: 0
enable_upload_image: false
searchable_at: null
promotion_title: null
extra_attributes:
metadata:
title: ''
description: ''
sort: 0
enable_note: true
thumbnail: >-
https://cdn.salla.sa/jKxK/udjbSQVDfMpHqvL6yikocZfeVH6U5I9gZEGatiiW.jpg
thumbnail_alt_seo: ''
target_donating_enable: false
unlimited_quantity: false
managed_by_branches: 1
notify_quantity: null
show_in_app: false
child: 1
customized_sku_quantity: 1
starting_price: null
custom_url: ''
calories: null
minimum_notify_quantity: 15
subscribers_percentage: 100
mpn: null
gtin: null
real_weight: null
weight_type: kg
show_in_mahly_app: 0
mahly_category_id: null
spam_status: 0
show_in_web: true
minimum_quantity_per_order: null
get:
type: product
discount_type: percentage
quantity: '10'
products: []
discount_amount: '20.00'
```
--------------------------------
### Verify Salla CLI Installation and Get Help
Source: https://docs.salla.dev/422761m0
Commands to verify the Salla CLI installation and display available commands. Running `salla` or `help` shows a list of all functionalities provided by the CLI.
```shell
salla
help
```
--------------------------------
### Salla Product Size Guide JavaScript Integration
Source: https://docs.salla.dev/422651m0
Demonstrates how to use the Salla JavaScript SDK to fetch product size guides and handle the responses. Includes examples for both successful fetches and error handling.
```js
salla.product.getSizeGuides(12345)
.then(response => {
// Do something with the size guide data
console.log(response);
})
.catch(error => {
// Handle any errors that occur
console.error(error);
});
```
--------------------------------
### Handle Size Guide Fetch Events
Source: https://docs.salla.dev/422651m0
Provides examples of how to listen for and handle events related to fetching product size guides using the Salla JavaScript SDK. Covers both successful and failed fetch events.
```js
salla.product.event.onSizeGuideFetched((response) => {
console.log(response)
});
salla.product.event.onSizeGuideFetchFailed((errorMessage) => {
console.log(errorMessage)
});
```
--------------------------------
### Store Configuration API
Source: https://docs.salla.dev/421117m0
Configure store settings and information through the Salla API.
```APIDOC
Store:
description: Configure store settings and information.
href: https://docs.salla.dev/api-5394261
```
--------------------------------
### Salla Merchant API Base URI
Source: https://docs.salla.dev/421117m0
All API URLs for the Salla Merchant APIs reference this base URI. This is the starting point for all requests to the Salla API.
```APIDOC
Base URI:
https://api.salla.dev/admin/v2
```
--------------------------------
### Reviews API
Source: https://docs.salla.dev/421117m0
Manage product and service reviews through the Salla API.
```APIDOC
Reviews:
description: Manage product and service reviews.
href: https://docs.salla.dev/api-5394279
```
--------------------------------
### Coupons API
Source: https://docs.salla.dev/421117m0
Handle the creation and management of discount coupons via the Salla API.
```APIDOC
Coupons:
description: Handle the creation and management of discount coupons.
href: https://docs.salla.dev/api-5394275
```
--------------------------------
### Theme Preview and Installation
Source: https://docs.salla.dev/421879m0
This covers previewing themes in demo and live stores, and the different installation methods available to developers. Previewing in a demo store allows for quality assurance before publication, while live store previews enable testing on actual stores.
```APIDOC
Theme Preview & Installation:
Preview (Demo Store):
- Platform: Partners Portal (https://salla.partners)
- Action: Create a demo store (if none exists), then click 'Preview Theme'.
- Purpose: Quality assurance before publication.
- Observation: Changes to components, pre-defined elements, and settings are reflected.
Preview (Live Store):
- Action: Add the store link and click 'sending the installation request'.
Installation Methods:
a. Public: Theme available for all stores.
b. Beta: Theme under development.
c. Private: Theme installable via an installation link.
d. Installation Link: Copyable link for private installations.
Completion: Successful theme setup is indicated upon reaching this stage.
Related: Theme setup, Theme details, Partners Portal
```
--------------------------------
### Product Configuration Example
Source: https://docs.salla.dev/5394218e0
Demonstrates the configuration of a product within the Salla platform, including its ID, name, pricing, availability, and associated attributes.
```json
{
"id": 1346261513,
"type": "product",
"promotion": {
"title": null,
"sub_title": null
},
"quantity": null,
"status": "sale",
"is_available": true,
"sku": "",
"name": "Kiwi",
"price": {
"amount": 200,
"currency": "SAR"
},
"sale_price": {
"amount": 200,
"currency": "SAR"
},
"currency": "SAR",
"url": "https://salla.sa/teenzaytoon_est/XeRemw",
"thumbnail": ">-
https://cdn.salla.sa/sArT8TSGYvmUO7t7D2yt3kg9f7gLMndsyXV330Ss.jpg",
"has_special_price": true,
"regular_price": {
"amount": 219,
"currency": "SAR"
},
"calories": null,
"mpn": null,
"gtin": null,
"description": "
",
"favorite": null,
"features": {
"availability_notify": {
"email": true,
"sms": true,
"mobile": false,
"whatsapp": false
},
"show_rating": false
}
}
```
--------------------------------
### Twilight JS Web Components - Installation & Usage
Source: https://context7_llms
Guide on installing and using Salla's Twilight Web Components across different frameworks. Includes setup with Tailwind CSS, CDN options, and event handling.
```APIDOC
Installation:
Via npm:
npm install @salla/twilight-components
Via CDN:
Usage:
Importing components:
import { SallaButton } from '@salla/twilight-components';
Using in HTML:
Click Me
Event Handling:
const button = document.querySelector('salla-button');
button.addEventListener('click', () => {
console.log('Button clicked!');
});
Customization:
Tailwind CSS integration for styling.
CSS Variables for theme customization.
Custom event handling for component interactions.
```
--------------------------------
### NPM Installation
Source: https://docs.salla.dev/422689m0
Installs the Twilight Components package using npm.
```bash
npm install @salla.sa/twilight-components --save
```
--------------------------------
### Salla App CLI Help
Source: https://docs.salla.dev/422766m0
Shows all commands and options specifically for managing Salla Apps. This includes creating, serving, deleting, and publishing apps.
```bash
salla app -h
```
--------------------------------
### Yarn Installation
Source: https://docs.salla.dev/422689m0
Installs the Twilight Components package using yarn.
```bash
yarn add @salla.sa/twilight-components
```
--------------------------------
### Get Product Size Guide
Source: https://docs.salla.dev/422651m0
Fetches the size guide for a specific product. Requires a product ID as input. The response includes size guide data or an error message.
```APIDOC
Endpoint: /products/{product_id}/size-guide
GET /products/{product_id}/size-guide
Description: Retrieves the size guide for a given product.
Parameters:
- product_id (integer, required): The ID of the product.
Responses:
- 200 OK: Returns the size guide information.
Content:
application/json
{
"data": { ... size guide details ... }
}
- 404 Not Found: If the product or its size guide is not found.
- 500 Internal Server Error: If there is a server error.
Related Events:
- onSizeGuideFetched: Triggered on successful retrieval.
- onSizeGuideFetchFailed: Triggered if an error occurs during retrieval.
```
--------------------------------
### Install Dependencies and Preview Theme
Source: https://docs.salla.dev/421878m0
This snippet demonstrates the essential commands to set up a Salla theme in a local development environment. It involves navigating to the theme directory, installing project dependencies using npm, and then starting the Salla theme preview server.
```shell
> cd theme_folder_name
> npm install
> salla theme preview
```
--------------------------------
### Check Salla CLI Version
Source: https://docs.salla.dev/422761m0
Displays the currently installed version of the Salla CLI. This is useful for confirming the installation and checking for updates.
```shell
salla --version
```
--------------------------------
### General Salla CLI Help
Source: https://docs.salla.dev/422766m0
Displays all available commands and options for the Salla CLI. This is the entry point for understanding the CLI's capabilities.
```bash
salla -h
```
--------------------------------
### Setup and Publish a Shipping App
Source: https://docs.salla.dev/851462f0
Explains the process of setting up a newly created Shipping App with necessary tweaks to become fully functional. It also covers the steps for publishing the app in the Salla Apps Store.
```markdown
## Setup App
After successfully creating a [Shipping App](?nav=01HNA8MH78MVX1S0DRXDHE3A1Kdoc-422995) it is now ready to have a few tweaks to become a fully functioning Shipping App and is able to be published in the [Salla Apps Store](https://apps.salla.sa).
```
--------------------------------
### Salla CLI for Theme Preview
Source: https://docs.salla.dev/421879m0
The Salla CLI is a command-line tool developed by the Salla team that can be used to preview themes. This provides a convenient way for developers to test their theme changes locally before deployment.
```APIDOC
Salla CLI:
preview
- Description: Previews a theme using the Salla Command Line Interface.
- Usage: salla preview
- Link: https://github.com/SallaApp/Salla-CLI
- Related: Theme installation, Theme setup
```
--------------------------------
### Install Salla CLI Globally
Source: https://docs.salla.dev/422761m0
Installs the Salla CLI globally on your system using npm. This command makes the `salla` binary available in your terminal.
```shell
npm install -g @salla.sa/cli
```
--------------------------------
### Salla OAuth2.0 Authorization and Installation URLs
Source: https://docs.salla.dev/421118m0
These are the primary URLs used to initiate the OAuth 2.0 authorization flow and install an application on the Salla platform.
```APIDOC
Authorization URL: https://accounts.salla.sa/oauth2/auth
Installation URL: https://s.salla.sa/apps/install/{app-id}
```
--------------------------------
### Basic Product Size Guide Usage
Source: https://docs.salla.dev/422721m0
Demonstrates how to use the `` to trigger the opening of the product size guide for a specific product ID. It also shows the inclusion of the `` component itself.
```html
Show Size Guide
```
--------------------------------
### Salla Merchant APIs Overview
Source: https://docs.salla.dev/421117m0
This section provides an overview of the available Salla Merchant APIs, categorized by functionality. Each category links to detailed API documentation for specific resources.
```APIDOC
Salla Merchant APIs:
Order Management:
- Abandoned Carts: Track and manage abandoned shopping carts.
- Order Assignments: Assign orders to specific employees or branches.
- Order Histories: Track and manage the history of orders.
- Order Invoices: Generate and manage order invoices.
- Order Items: Manage individual items within an order.
- Order Reservations: Handle order reservations and related actions.
- Order Statuses: Manage different statuses for orders.
- Order Tags: Assign and manage tags for orders.
- Orders: Handle order management and details.
- Exports: Export data related to products, orders, and other entities.
Product Management:
- Brands: Manage product brands in the store.
- Categories: Organize products into categories.
- Digital Products: Handle the management of digital products.
- Product Images: Manage images associated with products.
- Product Option Values: Manage specific values for product options.
- Product Options: Define and manage options available for products.
- Product Quantities: Track and manage product quantities in stock.
- Product Tags: Manage tags associated with products.
- Products: Handle product management including creation and updates.
- Product Variants: Manage different variants of products.
Customer Management:
- Customers: Manage customer information and profiles.
- Customer Groups: Organize customers into groups for targeted actions.
- Loyalty Points: Manage customer loyalty points.
Marketing and Sales:
- Advertisements: Handle advertisement settings and campaigns.
```
--------------------------------
### Install Rosetta on Apple Silicon Macs
Source: https://docs.salla.dev/422761m0
Installs Rosetta, a translation layer that allows Intel-based applications to run on Macs with Apple silicon. This is a prerequisite for running certain software on these machines.
```shell
softwareupdate --install-rosetta
```
--------------------------------
### Languages API
Source: https://docs.salla.dev/421117m0
Manage the languages available in the store through the Salla API.
```APIDOC
Languages:
description: Manage the languages available in the store.
href: https://docs.salla.dev/api-5738815
```
--------------------------------
### Offer Structure Example
Source: https://docs.salla.dev/5394218e0
This snippet demonstrates the structure of an offer, including its ID, name, message, dates, type, status, and application details. It shows how discounts are applied to products or payment methods.
```yaml
id: 287841836
name: test offer again 5555
message: اشتري 3 pieces واحصل على خصم 5 SAR من المنتجات التالية
expiry_date: '2022-03-13 00:00:00'
start_date: null
offer_type: fixed_amount
status: inactive
show_price_after_discount: null
show_discounts_table_message: false
applied_to: product
buy:
min_amount: 10
min_items: 0
products: []
get:
discount_amount: '5.00'
```
--------------------------------
### Preview Command with Store and Browser Options
Source: https://docs.salla.dev/422776m0
Illustrates how to use the 'preview' command with specific options to select a demo store and a browser for previewing the theme. This allows for targeted development and testing.
```shell
salla theme preview --store=sweet_store --with-editor --browser=chrome
```
```shell
salla theme preview store=3346 --browser=firefox
```
--------------------------------
### Affiliates API
Source: https://docs.salla.dev/421117m0
Manage affiliate programs and partnerships through the Salla API.
```APIDOC
Affiliates:
description: Manage affiliate programs and partnerships.
href: https://docs.salla.dev/api-5394270
```
--------------------------------
### Product Details Example
Source: https://docs.salla.dev/5394218e0
This snippet shows the structure of product data, including identifiers, pricing, availability, and descriptive information. It highlights fields like SKU, name, price, currency, URL, thumbnail, and features.
```json
{
"id": 1751601075,
"type": "product",
"promotion": {
"title": null,
"sub_title": null
},
"quantity": 5,
"status": "sale",
"is_available": true,
"sku": "IPHONE-X",
"name": "new_test",
"price": {
"amount": 10,
"currency": "SAR"
},
"sale_price": {
"amount": 0,
"currency": "SAR"
},
"currency": "SAR",
"url": "https://salla.sa/teenzaytoon_est/RADWGQv",
"thumbnail": ">-
https://cdn.salla.sa/jKxK/VMsAeQB3eW4j4MQ40GVx0pIBj2YpnDkgsx6x90TJ.jpg",
"has_special_price": false,
"regular_price": {
"amount": 10,
"currency": "SAR"
},
"calories": null,
"mpn": "",
"gtin": "",
"description": ">-
السلام عليكم ورحمة الله\nوبركاته
مساء الخير جميعاً
",
"favorite": null,
"features": {
"availability_notify": {
"email": true,
"sms": true,
"mobile": false,
"whatsapp": false
},
"show_rating": false
},
"starting_price": null
}
```
--------------------------------
### Currencies API
Source: https://docs.salla.dev/421117m0
Configure currencies available for transactions using the Salla API.
```APIDOC
Currencies:
description: Configure currencies available for transactions.
href: https://docs.salla.dev/api-5394257
```
--------------------------------
### Countries API
Source: https://docs.salla.dev/421117m0
Manage countries for localization and shipping via the Salla API.
```APIDOC
Countries:
description: Manage countries for localization and shipping.
href: https://docs.salla.dev/api-5394228
```
--------------------------------
### Offer Configuration: Buy X Get Y Discount
Source: https://docs.salla.dev/5394218e0
Illustrates a 'buy X get Y' offer configuration, specifying the type of offer, applied categories or products, and the discount details.
```json
{
"id": 1569519976,
"name": "New life",
"message": ">-
اشتري one piece واحصل على one piece خصم 20% من المنتجات
التالية",
"expiry_date": "2021-03-31 00:00:00",
"start_date": null,
"offer_type": "buy_x_get_y",
"status": "inactive",
"show_price_after_discount": null,
"show_discounts_table_message": false,
"applied_to": "category",
"buy": {
"type": "category",
"quantity": 1,
"categories": [
{
"id": 205564386,
"name": "فواكه",
"avatar": "",
"created_at": "2018-11-27T12:18:09.000000Z",
"updated_at": "2022-04-13T14:07:36.000000Z",
"deleted_at": null,
"store_id": 4934,
"parent_id": 0,
"products_counts": 4,
"show_in_menu": 1,
"sort_order": 39,
"status": "active",
"has_hidden_products": 0,
"show_in_app": 1,
"extra_attributes": [],
"custom_url": null,
"mahly_category_id": null,
"images": null
},
{
"id": 1255216786,
"name": "فواكه صيفية",
"avatar": "",
"created_at": "2020-12-26T16:30:42.000000Z",
"updated_at": "2020-12-27T08:56:15.000000Z",
"deleted_at": null,
"store_id": 4934,
"parent_id": 30535,
"products_counts": 1,
"show_in_menu": 1,
"sort_order": 1,
"status": "active",
"has_hidden_products": 0,
"show_in_app": 1,
"extra_attributes": [],
"custom_url": null,
"mahly_category_id": 454,
"images": null
}
]
},
"get": {
"type": "product",
"discount_type": "percentage",
"quantity": "1"
}
}
```
--------------------------------
### Cities API
Source: https://docs.salla.dev/421117m0
Manage cities for shipping and localization purposes through the Salla API.
```APIDOC
Cities:
description: Manage cities for shipping and localization.
href: https://docs.salla.dev/api-5394230
```
--------------------------------
### Salla Theme CLI Help
Source: https://docs.salla.dev/422766m0
Displays commands related to Salla Theme management, enabling theme creation, previewing, listing, deletion, and publishing.
```bash
salla theme --help
```