Dukaan Themes
  • Introduction to Dukaan Themes
  • Building your own custom theme
  • Getting the basics right
  • Making your first edit
  • Theme folder structure
  • How does it all work?
  • Nunjucks Templating Language
  • Basic code editing
    • Adding the HTML
    • Adding the CSS
    • Adding the Javascript
    • Adding Nunjucks
  • Customising Dukaan Templates
  • Dukaan Data
  • Advance code editing
    • Customising core functionality
  • Dukaan Functions
  • Integrating Dukaan Plugins
    • Wishlist plugin
    • Countdown timer plugin
    • Product scarcity plugin
  • Testing and Deploying Your Theme
  • Code Snippets
    • Changing text of Add to bag button
    • Adding shadow to product cards
    • Adding auto-scrolling text in homepage
Powered by GitBook
On this page

Was this helpful?

Dukaan Data

You can access your store data using these keys on server side with Nunjucks by simply mentioning the variable name. Example - {{DUKAAN_STORE.link}}

This data is available on client side in the window object in a key called Dukaan Data. For example window.DukaanData.DUKAAN_STORE

Variables

DUKAAN_STORE - Store related information like store id, store link, etc.

DUKAAN_CATEGORY_LIST - List of active categories

DUKAAN_CATALOG - This is list of Dukaan Categories with their products and other data

STORE_MENU - Navigation menu related data

Sample data
[
    {
        "id": 269676,
        "position": 0,
        "label": "Why to buy from us ?",
        "url": null,
        "content_type": "storepage",
        "content_object": {
            "id": 7697,
            "slug": "why-to-buy-from-us",
            "image": ""
        },
        "name": "Why to buy from us ?",
        "child": []
    },
    {
        "id": 269677,
        "position": 0,
        "label": "Harry Potter & The Philosopher's Stone",
        "url": null,
        "content_type": "product",
        "content_object": {
            "id": 38266106,
            "slug": "harry-potter-the-philosopher-s-stone-1",
            "image": "https://api.mydukaan.io/static/images/category-def.jpg"
        },
        "name": "Harry Potter & The Philosopher's Stone",
        "child": [
            {
                "id": 269678,
                "position": 0,
                "label": "TEST PRODUCT",
                "url": null,
                "content_type": "product",
                "parent_id": 269677,
                "content_object": {
                    "id": 38506255,
                    "slug": "test-product",
                    "image": "https://api.mydukaan.io/static/images/category-def.jpg"
                },
                "name": "pl",
                "child": []
            }
        ]
    },
    {
        "id": 269679,
        "position": 0,
        "label": "Harry Potter & The Philosopher's Stone",
        "url": null,
        "content_type": "product",
        "content_object": {
            "id": 38266105,
            "slug": "harry-potter-the-philosopher-s-stone",
            "image": "https://api.mydukaan.io/static/images/category-def.jpg"
        },
        "name": "Harry Potter & The Philosopher's Stone",
        "child": []
    }
]

DUKAAN_THEME_DATA - Theme related data like active theme, font, primary and secondary colors & theme sections

Sample data
{
    "store": 101561150,
    "payment_done": null,
    "meta": {
        "colors": {
            "primary": "#146eb4",
            "secondary": "#ee741f"
        },
        "header": {
            "showStoreImageOnly": false
        },
        "favicon": {
            "faviconUrl": "https://mydukaan.io/favicon.png"
        },
        "advanced": {
            "product": {
                "showAddToBagOnProductCard": true
            }
        }
    },
    "store_theme_data": {
        "id": 2270035,
        "twitterUrl": "",
        "instagramUrl": "",
        "facebookUrl": "",
        "linkedinUrl": "",
        "youtubeUrl": "",
        "pinterestUrl": "",
        "cxSupport": "+91-9040826685",
        "deliveryHappensWithIn": "3-5 days"
    }
}

DUKAAN_BANNERS - This is a list of top banners and their related data

Sample data
[
    {
        "id": 73413,
        "uuid": "85af7d36-904b-4eaf-8e0d-595bcf8b85cd",
        "is_active": true,
        "image": "https://dukaan-core-file-service.s3.ap-southeast-1.amazonaws.com/upload_file_service/ebaca373-2ed1-4c4e-8309-e1ca69dd7beb/image.png",
        "url": null,
        "position": 0,
        "store": "31d9141e-acc5-4bbe-ad6a-ea6ef13dccf9"
    },
    {
        "id": 25496,
        "uuid": "3e00dd26-1ea0-460b-bbd9-5ae7dbe86cb3",
        "is_active": true,
        "image": "https://dukaan-us.s3.amazonaws.com/5540936/5b45f4f7-f9f4-4358-9674-c97bed40d23b/image-86e59caa-9859-4898-94d2-d3fba32b8c79.png",
        "url": null,
        "position": 1,
        "store": "31d9141e-acc5-4bbe-ad6a-ea6ef13dccf9"
    }
]

Only the essential variables are mentioned above, you can view the other variables by running console.log(window.DukaanData)in your browser console.

PreviousCustomising Dukaan TemplatesNextAdvance code editing

Last updated 2 years ago

Was this helpful?