Zid Themes Library: API Integration
The Zid Themes Library is a comprehensive JavaScript library designed to facilitate interaction with various aspects of the Zid platform through REST API calls. It simplifies adding functionalities like product manipulation in the cart, customer address management, and accessing blog or category details, among others.
Integrating the Zid Themes Library
The library is provided as an asset file containing aĀ zid.store
Ā global object. This object can be integrated into any JavaScript file or script tag in your theme. To utilize the library, include theĀ zidapi_script
Ā variable at the bottom of the body tag in your HTML template:
<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>
Available Resources inĀ zidapi_script
TheĀ zidapi_script
Ā provides access to a range of resources essential for theme development:
- Product: Functions related to product display and management.
- Category: Tools for handling product categories
- Cart: Features for cart manipulation, including adding, removing, and updating items.
- Blog: Access to blog content and metadata.
- Customer: Customer information management tools.
- Settings: Functions for fetching and modifying store settings.
Utilizing these resources, you can enhance your theme with dynamic, interactive elements, providing a rich user experience on the Zid platform.