Zid Themes Docs
  • Getting started
  • Twig reference
  • Theme file structure
  • zid-theme package
  • Theme Templates and Data
    • layout.twig
  • Store language and currency
  • Home template modules
  • Product template
  • Cart template
  • Settings Schema
    • text
    • number
    • textarea
    • select
    • radios
    • checkbox
    • checkboxes
    • range
    • color
    • image
    • product
    • category
    • category products
    • list
    • fieldset
  • Data reference
    • locals
    • store
    • cart
    • product
    • products list
    • category
    • categories list
    • session
    • customer
    • faqs
    • blogs
    • blog
    • page
    • main menu
    • request
    • orders
    • addresses
    • store payment methods
    • store shipping methods
    • store banks
    • asset_url
    • header_meta_tags
  • Zid-api Library
    • Product
    • Category
    • Cart
    • Blog
    • Customer
    • Settings
  • Upload themes and more
Powered by GitBook
On this page

Was this helpful?

Zid-api Library

Previousheader_meta_tagsNextProduct

Last updated 3 years ago

Was this helpful?

Zid-themes library available as an asset file which has zid.store global object that can be accessed in any javascrip file or script tag. It provides multiple functions to make REST API calls, such as adding a product to cart, remove, update, fetch the customer address, and many other helper functions. To use it, add zidapi_script variable in the bottom of the body tag as follow (line 9):

<body>

    <div class="app">
        {% block header %}{% endblock %}
        {% block main_content %}{% endblock %}
        {% block footer %}{% endblock %}
    </div>

    {{ zidapi_script|raw }} // initialize Zid Library
    
    <script type="text/javascript" src="{{ asset_url ~ 'main.js' }}"></script>
</body>

zidapi_script resources:

Product
Category
Cart
Blog
Customer
Settings