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.