Zid Docs
  1. App API
Zid Docs
  • Merchant API
    • Start Here 🚀
    • Overview to Zid Apps
    • Authorization
    • Responses
    • Webhooks
    • Rate Limiting
    • APIs
      • Orders
        • Update Order by ID
        • Get Order Credit Notes
        • Get Order by ID
        • List of Orders
      • Reverse Orders
        • Reverse Order Reasons
        • Create Reverse Orders
        • Create Reverse Orders Waybill
        • Add Reverse Order Reasons
      • Carts
        • Get Abandoned Cart Details
        • List Abandoned Carts
      • Products
        • Managing Products
          • Get a Product by ID
          • Retrieve a list of products
          • Create a new product
          • Update an existing product.
          • Bulk update of products using their IDs or SKUs
          • Delete a product.
          • Product Setting
          • List Product Reviews
        • Digital Vouchers
          • Product Vouchers
          • Order Voucher
          • Add Product Voucher
          • Import Vouchers
          • Export Vouchers
          • Update Product Voucher
          • Remove Product Voucher
        • Product Categories
          • Get Single Category Details
          • Get all categories
          • Create Store Category
          • Update a Store Category
          • Add a product to a certain category
          • Publish/Unpublish a Category
          • Detach Category from All Products
          • Remove Category from Product
        • Product Badge
          • Product Badge
        • Product Attributes
          • Get Product Attributes
          • Get Product Attributes
          • Retrieve a product attribute
          • Add a New Product Attribute
          • Add a New Product Attribute
          • Update a product attribute
          • Delete a product attribute
        • Product Attribute Presets
          • Get attribute presets
          • Create Attribute Preset
          • Update Attribute Preset
          • Delete an attribute preset
        • Product Customizations
          • Add Product Variants
          • Insert Custom Options to a Product
          • Insert Custom User-Input Fields to a Product
        • Product Manual Sorting
          • Set Custom Product Order
          • Reset the manual sorting of all products
        • Product Images
          • Get List of images of a product.
          • Add an image to a product
          • Update a product Image Order
          • Delete a product image
        • Product Notifications
          • Availability Notification Stats
          • Availability Notifications Settings
          • List Availability Notifications
          • Add Availability Notification
          • Save Availability Notifications Settings
          • Manually Send Availability Notification Email
          • Export Availability Notifications
        • Product Import
          • Email All Products to Store Owner
          • Import Products via CSV or xlsx File
        • Product Stock (Multi-Inventory)
          • Get Product Stock by ID
          • List Product Stocks
          • Add Product Stock
          • Update Single Product Stock
          • Bulk Update Product Stocks
        • Product Questions & Answers
          • Get Question
          • Get Answer
          • Get All Questions
          • List Question Answers
          • Create Question
          • Create Answer
          • Update Question
          • Update Answer
          • Delete Question
          • Delete Answer
        • Product Reviews
          • List Reviews
          • New Reviews Total
          • Change Review Status
          • Bulk Change all Review Statuses
          • Delete Review
          • Import Product Reviews
          • Reply to Review
          • Delete Reply
          • Update Reply to Review
        • Digital Products
          • Create Downloadable Product
          • Generate an Upload URL
          • Upload File to S3
          • Create Product Downloadables
          • Get Product Downloadables
          • Delete Product Downloadables
          • Get Store Downloadables
          • Create Store Downloadables
          • Delete Store Downloadables
      • Inventories
        • Get Store Location by ID
        • List Store Locations
        • Add a New Location
        • Update a Location by ID
        • Update Products Stock by Location ID
      • Shipping
        • List Store Delivery Options
        • Add Shipping Option
      • Marketing
        • Gift Cards
          • Get Store Settings
          • Add gift card to the cart
          • Update Store Settings
          • Upload gift card designs
          • Remove gift card from the cart
        • Coupons
          • Create a New Coupon
          • List Coupons
          • Get Coupon Details
          • Update Coupon
          • Delete Coupon
        • Bundle Offers
          • Retrieve all Bundle Offers
        • Loyalty Program
          • Customer Wallet
          • Customer Points
          • Loyalty Program Points per Order
          • Store Loyalty Status
          • Redemption Methods
          • Cashback Rules
          • Add Redemption to Cart
          • Remove Redemption from Cart
          • Info Page
          • Loyalty Program Activation
          • Loyalty Status
          • Set Points Expiration
          • Cashback Rule Method Update
          • Cashback Rule Method Update Status
          • Add Points Redemption Method
          • Update Points Redemption Method
          • Delete Points Redemption Method
          • Toggle Redemption Method Status
          • Show Loyalty Points Info for Specific Customer
          • Customer Profile
          • List Data
          • Customer Points History
          • Info Page - Managers
          • Update Info Page
          • Adjust Customer Points
      • Customers
        • List of Customers
        • Get Customer by ID
      • Store Settings
        • 📄 User Roles and Permissions
        • Get Manager's Profile
        • Get VAT Settings
        • List of Payment Method
      • Countries and Cities
        • Retrieve Store Operating Countries
        • Retrieve Cities by Country ID
        • Countries List
      • Webhook
        • List of Webhooks
        • Create a Webhook
        • Delete a Webhook by OriginalId
        • Delete a Webhook by Subscriber
    • Store Events
      • Order
      • Product
      • Abandoned Cart
      • Customer
      • Product Category
  • App API
    • Create your First App
    • Embedded Apps
    • App Scripts
    • App Events
    • App Subscription
      • Get Subscription Details
      • Update Usage-Based Charges
  • Themes
    • 🚨 Important Update: Zid Themes
    • Adding Video URL Feature to Third-Party Themes
    • Landing Page Development
    • Getting Started with Zid Themes
      • Introduction to Theme Development
      • Manage your Themes
      • Building Themes in Zid
      • Theme File Structure
      • Twig Syntax and Features
      • Zid Theme Packager
    • Templates
      • Layout
      • Home Page
      • Products
      • Cart
      • Store Language and Currency
    • Settings Schema
      • Text
      • Number
      • Text-Area
      • Select
      • Radio Buttons
      • Checkbox
      • Range
      • Color
      • Image
      • Product
      • Category
      • List
      • Fieldset
    • Code Snippets
      • Apple Pay Quick Checkout
      • Custom CSS Injection
      • Displaying the Store's Business Center Logo
      • Customizing Copyright Text
      • Store's Main Navigation Menu
      • Customer Wishlist
      • Products
        • Products Badges
        • Product Ratings
        • Remaining Product Stock
        • Sold Items Count
        • Product Filtration by Attributes
        • Grouped Products
        • Product Questions & Answers
        • Product Restock Notfication
      • SEO
        • Images alt text
        • Themes SEO Marketing Tags
      • Marketing
        • Metafields
        • Gift Feature
        • Loyalty Program
    • Zid Themes Library: API Integration
      • Products
      • Product Categories
      • Cart
      • Blog
      • Customer
      • Store Settings
    • Data Reference
      • Locals
      • Store
      • Cart
      • Product
      • Products List
      • Category
      • Categories List
      • Session
      • FAQs
      • Customer
      • Blogs
      • Page
      • Main Menu
      • Main Navigation Menu
      • Request
      • Orders
      • Addresses
      • Store Payment Methods
      • Store Shipping Methods
      • Store Banks
      • Asset URL
      • Header Meta Tags
      • Loyalty pogram Wallet
    • Themes CLI
      • CLI Authentication
      • Theme Create
      • Theme Package
      • Theme Update
      • Themes List
      • Theme Preview
  1. App API

App Scripts

Zid App Scripts allow merchants to inject custom JavaScript directly into their storefront through the Partner Dashboard. This enables dynamic user interactions and personalized experiences.
This documentation outlines the process of injecting global scripts and implementing event-specific scripts that respond to user actions in real-time.

Global and Customer Object Scripting#

Zid’s API supports two types of global objects for advanced scripting:
1.
Global Object: Loads upon page initialization and can include custom JS utility files.
2.
Customer Object: Contains details of the currently logged-in customer. If no user is logged in, the object remains empty.

Global Object Parameters:#

ParameterDescription
window.customerContains details of the logged-in customer. Empty if no user is logged in.

Customer Object Blueprint:#

ParameterDescription
idUnique identifier for the customer
nameFull name of the customer
mobileMobile number of the customer
emailEmail address of the customer
These global objects enable dynamic interactions and personalized user experiences.

Event-Driven Scripting#

Zid supports event-driven scripting, allowing JavaScript execution in response to specific storefront events. These events trigger JavaScript functions to track user interactions and enhance engagement.
Supported Events:
1.
Purchase Event
2.
Product View Event
3.
Add to Cart Event
4.
Remove from Cart Event
5.
Start Checkout Event
(Please note that productCart refers to the product in the cart, and productViewd refers to the viewed product. The unconventional spelling is consistent with the codebase.)

1. Purchase Event#

ParameterDescription
transactionItemsList of products the user purchased.
idOrder Id
product idProduct Id
nameProduct Name
skuProduct Sku code
categoryProduct Category Name
priceProduct Price
quantityProduct Quantity
currencycurrency
totalProduct Total

2. Product View Event#

ParameterDescription
productViewdSingle product details object.
idProduct Id
nameProduct Name
categoryProduct Category Name
priceProduct Price
positionDisplay Order

3. Add to Cart Event#

ParameterDescription
productCartSingle product cart object.
idProduct Id
nameProduct Name
categoryProduct Category Name
priceProduct Price
positionDisplay Order
listName of page
quantityProduct Quantity

4. Remove from Cart Event#

ParameterDescription
productCartSingle product cart object.
idProduct Id
nameProduct Name
categoryProduct Category Name
priceProduct Price
positionDisplay Order
listName of page
quantityProduct Quantity

5. Start Checkout Event Parameters#

ParameterDescription
cart_idUnique identifier for the shopping cart.
cart_totalTotal value of the cart.
currencyCurrency used for the transaction.
itemsList of items in the cart, each represented by its own object.
item_idUnique identifier for each product in the cart.
item_nameName of the product.
item_pricePrice of the product.
item_quantityQuantity of the product in the cart.
item_categoryCategory of the product.
user_idUnique identifier of the user (if logged in).
session_idUnique identifier for the session (if user is not logged in).
cart_discountAny discount applied to the cart.
shipping_costEstimated shipping cost for the cart.
checkout_stepCurrent step in the checkout process (e.g., shipping, payment, confirmation).
payment_methodSelected payment method (if chosen).

Script Injection for App Partners#

Custom Snippets allow you to inject scripts into stores where your app is installed, enabling enhanced functionality, better store customization, and seamless integration. This feature provides flexibility to optimize the merchant experience without requiring them to manually modify their store’s code.

How to Enable Custom Snippets#

Group 1321314716.png
Before publishing, always test your changes in a development store to ensure smooth functionality. Optimize scripts for performance to prevent any impact on storefront loading times.
1.
Open the Partner Dashboard and navigate to the General Settings of your app.
2.
Click on Add Snippet and enter your JavaScript or CSS snippet in the provided field.
3.
Define the snippet’s placement and configure any required parameters.
4.
Submit your changes for review and approval. You can modify or remove the snippet from your app at any time.
Modified at 2025-03-12 20:59:28
Previous
Embedded Apps
Next
App Events
Built with