Table of Contents
Introduction
हेलो दोस्तों आज हम इस post में हम जानेगे की Shopify के साथ as shopify developer के तोर पर काम करने के लिए हमें कितनी shopify की knowledge की जरूर होती है वह हम इस post में जानगे!. Shopify के साथ काम करने के लिए कुछ basic और advanced knowledge की ज़रूरत होती है!.
अगर आप Shopify development में काम कर रहे हैं, तोह आपको Liquid, Shopify APIs, और theme customization के concepts समझने होंगे. मैं यहाँ step-by-step आपको बताऊंगा की किस तरह से आपको Shopify के key features, जैसे tags, filters, conditions, और दुसरे important topics को समझना होगा!.
Shopify Liquid Programming Language
Liquid Shopify का templating language है, जिसमे आप theme के content को dynamic बना सकते हैं!. आपको Liquid syntax को समझना होगा, जैसे tags, variables, loops, conditions, filters, etc.
{% assign product_tags = product.tags %} {% for tag in product_tags %} <p>{{ tag }}</p> {% endfor %}
ऊपर के example में देख सकते है हमने इस example में product tags को loop करके display कर रहे हैं!
Tags in Shopify
Shopify में tags use होते हैं जैसे की products, collections, customers को tags के आधार पर categorize कर सकते है!. आप tags को filter करने के लिए Liquid में use कर सकते हैं!. जैसे के आप tag के हिसाब से product को show करा सकते हैं, tag के based पैर आप customer के लिए condition set कर सकते है तो shopify में tag का इस्तेमाल करके कई तरीके की condifiton और filter को रख सकते है!.
Collection products Filter using the tag
अगर हमें colleciton page पर products को tag के आधार पर show करना हो तो आप निचे दिए example में देख सकते है!.
Example
{% assign filtered_products = collections.frontpage.products | where: "tags", "new-arrival" %} {% for product in filtered_products %} <div>{{ product.title }}</div> {% endfor %}
ऊपर के example में देख सकते है collection product को हमने “new-arrival” tag के आधार पर filter करके show करा है!.
Filters
Shopify liquid codes में Filters को आप data को modify करने के लिए इस्तेमाल कर सकते है!. Shopify में कुछ built-in filter होते हैं जो आपको text, number, dates और arrays को manipulate करने में मदद करते हैं!.
Common Filters
capitalize
{{ "hello world" | capitalize }} Output: Hello world
Sirf first अक्षर को capital करता है।
upcase
{{ "hello world" | upcase }} Output: HELLO WORLD
पुरे text को uppercase में update करता है!.
downcase
{{ "HELLO WORLD" | downcase }} Output: hello world
पुरे text को downcase में convert करने लिए है!.
replace
{{ "Hello Liquid" | replace: "Liquid", "Shopify" }} Output: Hello Shopify
एक word को दूसरे word के साथ replace करने के लिए इस्तेमाल होता है!.
Conditions
आप conditions को use करके specific conditions चेक कर सकते हैं और उसके accordingly content display कर सकते हैं!.
Display content based on tag
{% if product.tags contains 'sale' %} <p>This product is on sale!</p> {% endif %}
ऊपर example में देख सकते है की हमने product को उसके tag “sale” को चेक करके उसके according एलिमेंट को show करा है!
Filters for Collections
आप collections को भी filter कर सकते हैं tag या price के basis पर. इससे आपको customers को specific products दिखने में मदद मिलती है!.
Example
{% assign filtered_products = collections.all.products | where: "price", 1000 %} {% for product in filtered_products %} <div>{{ product.title }}</div> {% endfor %}
Shopify APIs
अगर आप Shopify के backend से data manipulate करना चाहते हैं या custom features build करना चाहते हैं, तोह आपको Shopify APIs का भी knowledge होना चाहिए!. Shopify APIs के through आप data को manage कर सकते हैं जैसे orders, products, customers, etc.
Storefront API: Frontend से data fetch करने के लिए!.
Admin API: Backend से data manage करने के लिए!.
Shopify Tags and Search Filters
आप tags को search filters के साथ combine कर सकते हैं!. जैसे अगर आप tag के basis पर products को search करना चाहते हैं, तोह आप search page पे filter लगा सकते हैं!.
Example
{% if search.results %} {% for result in search.results %} {% if result.object_type == 'product' %} {% if result.product.tags contains 'new' %} <p>{{ result.product.title }}</p> {% endif %} {% endif %} {% endfor %} {% endif %}
Pagination in Shopify
अगर आपको large number of products display करना है, तोह आपको pagination की ज़रूरत पड़ेगी!.
Example
{% paginate collection.products by 12 %} {% for product in collection.products %} <p>{{ product.title }}</p> {% endfor %} <div class="pagination"> {% if paginate.previous %} <a href="{{ paginate.previous.url }}">Previous</a> {% endif %} {% if paginate.next %} <a href="{{ paginate.next.url }}">Next</a> {% endif %} </div> {% endpaginate %}
Tags को समझना और use करना basic है!, जिसे आप collections या products को filter करने के लिए use कर सकते हैं!.
Filters को समझना ज़रूरी है जिसे आप dynamic content को display करने के लिए use करते हैं!. Conditions का use करके आप dynamic decisions ले सकते हैं की क्या content display करना है!. Shopify APIs का knowledge होना ज़रूरी है अगर आप custom functionalities चाहते हैं!.
आपको Liquid की basic understanding होने चाहिए, और साथ ही Shopify की internal systems को समझना भी ज़रूरी है जैसे tags, filters, और conditions. इससे आप efficiently Shopify stores को customize और optimize कर सकते हैं!.