ÈËÉú¾ÍÊDz©¡¤(Öйú)×ðÁúAGÆì½¢Ìü

ÈËÉú¾ÍÊDz©¡¤(Öйú)×ðÁúAGÆì½¢Ìü(LianLian Global)¹ÙÍøÊ×Ò³

shopify½¨Éè¡°ÄúÊÇÔõÑùÏàʶµ½ÎÒÃÇÊÐËÁµÄ£¿£¿£¿ £¿ £¿£¿£¿£¿¡±±íµ¥×ֶΰ취

shopify¿Í»§shopify±íµ¥×Ö¶Î
2022/03/08
×Ô½¨Õ¾

ѯÎʿͻ§ÏàʶÄúÊÐËÁµÄ;¾¶

±¸×¢

ÈôÊÇÄúʹÓàShopify µÄÃâ·ÑÄ£°å£¬£¬£¬ £¬£¬Äú¿ÉÒÔÁªÏµ Shopify Ö§³ÖÍŶӻñµÃ¹ØÓڴ˽̵̳Ä×ÊÖú¡£¡£¡£¡£¡£´Ë½Ì³ÌÐèÒª 15 ·ÖÖÓµÄÉè¼ÆÊ±¼ä¡£¡£¡£¡£¡£ÈôÒªÏàʶÏêÇ飬£¬£¬ £¬£¬Çë²ÎÔÄ Support for themes¡£¡£¡£¡£¡£

±¸×¢

´Ë×Ô½ç˵ÓÃÓÚ¸´¹Å Shopify Ä£°å£¬£¬£¬ £¬£¬²»ÊÊÓÃÓÚ¡°Online Store 2.0¡±Ä£°å¡£¡£¡£¡£¡£

  • ÕÒµ½ÄúµÄÄ£°å¼Ü¹¹°æ±¾

  • ̽Ë÷¡°Online Store 2.0¡±Ä£°å×Ô½ç˵

Äú¿ÉÒÔͨ¹ýÏò¹ºÎï³µÒ³ÃæÌí¼ÓÄúÊÇÔõÑùÏàʶµ½ÎÒÃÇÊÐËÁµÄ£¿£¿£¿ £¿ £¿£¿£¿£¿±íµ¥×Ö¶ÎÀ´Ñ¯Îʿͻ§ÏàʶÄúÊÐËÁµÄ;¾¶¡£¡£¡£¡£¡£

×¢ÖØ

´Ë×Ô½ç˵ÉèÖò»ÊÊÓÃÓÚ³éÌëʽ»òµ¯³öʽ¹ºÎï³µ£¬£¬£¬ £¬£¬½öÊÊÓÃÓÚ¹ºÎï³µÒ³Ãæ£¨Î»ÓÚ URL your-store.com/cart£©¡£¡£¡£¡£¡£ÈôÊÇÄúʹÓùºÎï³µ³éÌë»òµ¯³öʽ¹ºÎï³µ£¬£¬£¬ £¬£¬Äú½«ÐèÒªÔÚÄ£°å±à¼­Æ÷Öн«ÄúµÄ¹ºÎï³µÑùʽ¸ü¸ÄΪ¹ºÎï³µÒ³Ãæ¡£¡£¡£¡£¡£ÔÚÄ£°åÔ¤ÀÀÖÐÏò¹ºÎï³µÖÐÌí¼Ó²úÆ·£¬£¬£¬ £¬£¬È»ºóµã»÷Ä£°å±à¼­Æ÷ÖеĹºÎï³µÒ³ÃæÑ¡Ï£¬£¬£¬ £¬£¬ÒÔÉó²éÄúµÄ¹ºÎï³µÉèÖᣡ£¡£¡£¡£

½¨Éè¡°ÄúÊÇÔõÑùÏàʶµ½ÎÒÃÇÊÐËÁµÄ£¿£¿£¿ £¿ £¿£¿£¿£¿¡±±íµ¥×Ö¶Î

ÈôÒª½¨ÉèÄúÊÇÔõÑùÏàʶµ½ÎÒÃÇÊÐËÁµÄ£¿£¿£¿ £¿ £¿£¿£¿£¿±íµ¥×ֶΣ¬£¬£¬ £¬£¬ÇëÖ´ÐÐÒÔϲÙ×÷£º

PC£º

  1. ÔÚ Shopify ºǫ́ÖУ¬£¬£¬ £¬£¬×ªµ½ÔÚÏßÊÐËÁ > Ä£°å¡£¡£¡£¡£¡£

  2. ÕÒµ½Òª±à¼­µÄÄ£°å£¬£¬£¬ £¬£¬È»ºóµã»÷²Ù×÷ > ±à¼­´úÂë¡£¡£¡£¡£¡£

  1. ÔÚ Snippets Ä¿Â¼Öеã»÷Ìí¼ÓÐÂÆ¬¶Ï¡£¡£¡£¡£¡£

  2. ½¨Éè´úÂëÆ¬¶Ï£º

    1. ½«´úÂëÆ¬¶ÏÃüÃûΪ hear-about-us¡£¡£¡£¡£¡£

    2. µã»÷½¨ÉèÆ¬¶Ï¡£¡£¡£¡£¡£

Æ»¹ûϵͳ£º

  1. ÔÚ Shopify Ó¦ÓÃÖУ¬£¬£¬ £¬£¬Çá´¥ÊÐËÁ¡£¡£¡£¡£¡£

  2. ÔÚÏúÊÛÇþµÀ²¿·ÖÖУ¬£¬£¬ £¬£¬Çá´¥ÔÚÏßÊÐËÁ¡£¡£¡£¡£¡£

  3. Çá´¥ Manage themes£¨ÖÎÀíÄ£°å£©¡£¡£¡£¡£¡£

  4. ÕÒµ½Òª±à¼­µÄÄ£°å£¬£¬£¬ £¬£¬È»ºóµã»÷²Ù×÷ > ±à¼­´úÂë¡£¡£¡£¡£¡£

  1. ÔÚ Snippets Ä¿Â¼Öеã»÷Ìí¼ÓÐÂÆ¬¶Ï¡£¡£¡£¡£¡£

  2. ½¨Éè´úÂëÆ¬¶Ï£º

    1. ½«´úÂëÆ¬¶ÏÃüÃûΪ hear-about-us¡£¡£¡£¡£¡£

    2. µã»÷½¨ÉèÆ¬¶Ï¡£¡£¡£¡£¡£

°²×¿ÏµÍ³£º

  1. ÔÚ Shopify Ó¦ÓÃÖУ¬£¬£¬ £¬£¬Çá´¥ÊÐËÁ¡£¡£¡£¡£¡£

  2. ÔÚÏúÊÛÇþµÀ²¿·ÖÖУ¬£¬£¬ £¬£¬Çá´¥ÔÚÏßÊÐËÁ¡£¡£¡£¡£¡£

  3. Çá´¥ Manage themes£¨ÖÎÀíÄ£°å£©¡£¡£¡£¡£¡£

  4. ÕÒµ½Òª±à¼­µÄÄ£°å£¬£¬£¬ £¬£¬È»ºóµã»÷²Ù×÷ > ±à¼­´úÂë¡£¡£¡£¡£¡£

  1. ÔÚ Snippets Ä¿Â¼Öеã»÷Ìí¼ÓÐÂÆ¬¶Ï¡£¡£¡£¡£¡£

  2. ½¨Éè´úÂëÆ¬¶Ï£º

    1. ½«´úÂëÆ¬¶ÏÃüÃûΪ hear-about-us¡£¡£¡£¡£¡£

    2. µã»÷½¨ÉèÆ¬¶Ï¡£¡£¡£¡£¡£

  1. ÔÚеĠhear-about-us.liquid ´úÂëÆ¬¶ÏÖУ¬£¬£¬ £¬£¬Õ³ÌùÒÔÏ´úÂ룺

```liquid <style> #how-did-you-hear-about-us--label, #how-did-you-hear-about-us-other--label {     font-weight: bold; } select#how-did-you-hear-about-us, input#how-did-you-hear-about-us-other {     width: 100%;     padding: 8px 10px 8px 10px;     line-height: 1.2; } #how-did-you-hear-about-us, #how-did-you-hear-about-us-other, #how-did-you-hear-about-us--label, #how-did-you-hear-about-us--error, #how-did-you-hear-about-us-other--label, #how-did-you-hear-about-us-other--error {     display:block;     margin-bottom: 5px; } #how-did-you-hear-about-us-other.error, #how-did-you-hear-about-us.error {     border: 2px solid {{ settings.hau_error_color }}; } #how-did-you-hear-about-us--error, #how-did-you-hear-about-us-other--error {     color: {{ settings.hau_error_color }}; } </style> <div> <p>     <label id="how-did-you-hear-about-us--label" for="how-did-you-hear-about-us">How did you hear about us?</label>     <span id="how-did-you-hear-about-us--error" style="display:none">{{ settings.hau_error_message }}</span>     <select id="how-did-you-hear-about-us" name="attributes[how-did-you-hear-about-us]">     <option value=""{% if cart.attributes.how-did-you-hear-about-us == "" %} selected{% endif %}>Please make a selection</option>     {% assign optionsArray = settings.hau_form_options | split: ',' %}     {% for o in optionsArray %}     {% assign option = o | strip %}     <option value="{{ option }}"{% if cart.attributes.how-did-you-hear-about-us == option %} selected{% endif %}>{{ option }}</option>     {% endfor %}     <option value="Other"{% if cart.attributes.how-did-you-hear-about-us == "Other" %} selected{% endif %}>Other</option>     </select> </p> <p id="otherFormWrapper" style="{% unless cart.attributes.how-did-you-hear-about-us == 'Other' %}display:none{% endunless %}">     <label id="how-did-you-hear-about-us-other--label" for="how-did-you-hear-about-us-other">Other</label>     <span id="how-did-you-hear-about-us-other--error" style="display:none">{{ settings.hau_error_message_other }}</span>     <input id="how-did-you-hear-about-us-other" type="text" name="attributes[how-did-you-hear-about-us-other]" value="{{ cart.attributes.how-did-you-hear-about-us-other }}"/> </p> </div> <script> (function() {     document.addEventListener("DOMContentLoaded", initForm);     document.addEventListener("shopify:section:load", initForm);     function initForm(){     var formElement = document.querySelector('#how-did-you-hear-about-us');     var formError = document.querySelector('#how-did-you-hear-about-us--error');     var otherFormElement = document.querySelector('#how-did-you-hear-about-us-other');     var otherFormError = document.querySelector('#how-did-you-hear-about-us-other--error');     var otherFormWrapper = document.querySelector('#otherFormWrapper');     var checkoutButtons = document.querySelectorAll('[name="checkout"], [name="goto_pp"], [name="goto_gc"]');     function showOrHideForm(){         if (formElement.value == 'Other'){         otherFormWrapper.style.display = '';         } else {         otherFormWrapper.style.display = 'none';         }     }     function checkFormElement(){         if (formElement.value.length == 0){         formElement.classList.add('error');         formError.style.display = '';         } else {         if (formElement.classList.contains('error')){             formElement.classList.remove('error');             formError.style.display = 'none';         }         }     }     function checkOtherFormElement(){         if (otherFormElement.value.length == 0){         otherFormElement.classList.add('error');         otherFormError.style.display = '';         } else {         if (otherFormElement.classList.contains('error')){             otherFormElement.classList.remove('error');             otherFormError.style.display = 'none';         }         }     }     otherFormElement.addEventListener("input", function() {         {% if settings.hau_form_validation %}         checkOtherFormElement();         {% endif %}     });     formElement.addEventListener("change", function() {         showOrHideForm();         {% if settings.hau_form_validation %}         checkFormElement();         {% endif %}     });     checkoutButtons.forEach(function(element){         element.addEventListener("click", function(evt) {         {% if settings.hau_form_validation %}         var validated = true;         if (formElement.value.length == 0){             checkFormElement();             validated = false;         }         if (formElement.value == 'Other'){             if (otherFormElement.value.length == 0){             checkOtherFormElement();             validated = false;             }         }         if (!validated) {             evt.preventDefault();             evt.stopPropagation();         }         {% endif %}         });     });     } })() </script>
1. µã»÷**ÉúÑÄ**¡£¡£¡£¡£¡£ ## ÔÚ¹ºÎï³µÒ³ÃæÖаüÀ¨´úÂëÆ¬¶Ï ÈôÒªÔÚ¹ºÎï³µÒ³ÃæÖаüÀ¨**ÄúÊÇÔõÑùÏàʶµ½ÎÒÃÇÊÐËÁµÄ£¿£¿£¿£¿£¿£¿£¿£¿**´úÂëÆ¬¶Ï£¬£¬£¬£¬£¬ÇëÖ´ÐÐÒÔϲÙ×÷£º 1. ÔÚ **Sections** Ä¿Â¼ÖУ¬£¬£¬£¬£¬µã»÷ `cart-template.liquid`¡£¡£¡£¡£¡£ÈôÊÇÄúµÄÄ£°åÖв»°üÀ¨ `cart-template.liquid`£¬£¬£¬£¬£¬Çëµã»÷ **Templates** Ä¿Â¼ÖеĠ`cart.liquid`¡£¡£¡£¡£¡£ 2. [²éÕÒ](/manual/shopify-admin/productivity-tools/keyboard-shortcuts#find)´úÂëÖеĿ¢Ê `</form>` ±ê¼Ç¡£¡£¡£¡£¡£ÔÚ¿¢Ê `</form>` ±ê¼ÇÉÏ·½µÄÐÂÐÐÖУ¬£¬£¬£¬£¬Õ³ÌùÒÔÏ´úÂ룺 ```liquid {% render 'hear-about-us' %}
  1. µã»÷ÉúÑÄ¡£¡£¡£¡£¡£

ShopifyÉÌ»§¹ÙÍøÔ­ÎÄÏêÇ飺

Ask how customers heard about your store

Note

If you use a free theme from Shopify, then you might be able to contact Shopify Support for help with this tutorial. It requires 15 minutes of design time. To learn more, refer to Support for themes.

Note

This customization is for vintage Shopify themes, and doesn't apply to Online Store 2.0 themes.

  • Find out your theme's architecture version

  • Explore Online Store 2.0 theme customizations

You can ask your customers how they heard about your store by adding a How did you hear about us? form field to your cart page.

Caution

This customization will not work for drawer or pop-up cart styles, and will only work for a cart page (at the URL your-store.com/cart). If you use a cart drawer or pop-up, then you will need to change your cart style to Page in the theme editor. Add a product to the cart in the theme preview, and then click the Cart page tab in the theme editor to view your cart settings.

Create the 'How did you hear about us?' form field

To create the How did you hear about us? form field:

PC£º

  1. From your Shopify admin, go to Online Store > Themes.

  2. Find the theme you want to edit, and then click Actions > Edit code.

  1. In the Snippets directory, click Add a new snippet.

  2. Create the snippet:

    1. Name your snippet hear-about-us.

    2. Click Create snippet.

iPhone£º

  1. From the Shopify app, tap Store.

  2. In the Sales channels section, tap Online Store.

  3. Tap Manage themes.

  4. Find the theme you want to edit, and then click Actions > Edit code.

  1. In the Snippets directory, click Add a new snippet.

  2. Create the snippet:

    1. Name your snippet hear-about-us.

    2. Click Create snippet.

Android£º

  1. From the Shopify app, tap Store.

  2. In the Sales channels section, tap Online Store.

  3. Tap Manage themes.

  4. Find the theme you want to edit, and then click Actions > Edit code.

  1. In the Snippets directory, click Add a new snippet.

  2. Create the snippet:

    1. Name your snippet hear-about-us.

    2. Click Create snippet.

  1. In your new hear-about-us.liquid snippet, paste the following code:

    <style> #how-did-you-hear-about-us--label, #how-did-you-hear-about-us-other--label {     font-weight: bold; } select#how-did-you-hear-about-us, input#how-did-you-hear-about-us-other {     width: 100%;     padding: 8px 10px 8px 10px;     line-height: 1.2; } #how-did-you-hear-about-us, #how-did-you-hear-about-us-other, #how-did-you-hear-about-us--label, #how-did-you-hear-about-us--error, #how-did-you-hear-about-us-other--label, #how-did-you-hear-about-us-other--error {     display:block;     margin-bottom: 5px; } #how-did-you-hear-about-us-other.error, #how-did-you-hear-about-us.error {     border: 2px solid {{ settings.hau_error_color }}; } #how-did-you-hear-about-us--error, #how-did-you-hear-about-us-other--error {     color: {{ settings.hau_error_color }}; } </style> <div> <p>     <label id="how-did-you-hear-about-us--label" for="how-did-you-hear-about-us">How did you hear about us?</label>     <span id="how-did-you-hear-about-us--error" style="display:none">{{ settings.hau_error_message }}</span>     <select id="how-did-you-hear-about-us" name="attributes[how-did-you-hear-about-us]">     <option value=""{% if cart.attributes.how-did-you-hear-about-us == "" %} selected{% endif %}>Please make a selection</option>     {% assign optionsArray = settings.hau_form_options | split: ',' %}     {% for o in optionsArray %}     {% assign option = o | strip %}     <option value="{{ option }}"{% if cart.attributes.how-did-you-hear-about-us == option %} selected{% endif %}>{{ option }}</option>     {% endfor %}     <option value="Other"{% if cart.attributes.how-did-you-hear-about-us == "Other" %} selected{% endif %}>Other</option>     </select> </p> <p id="otherFormWrapper" style="{% unless cart.attributes.how-did-you-hear-about-us == 'Other' %}display:none{% endunless %}">     <label id="how-did-you-hear-about-us-other--label" for="how-did-you-hear-about-us-other">Other</label>     <span id="how-did-you-hear-about-us-other--error" style="display:none">{{ settings.hau_error_message_other }}</span>     <input id="how-did-you-hear-about-us-other" type="text" name="attributes[how-did-you-hear-about-us-other]" value="{{ cart.attributes.how-did-you-hear-about-us-other }}"/> </p> </div> <script> (function() {     document.addEventListener("DOMContentLoaded", initForm);     document.addEventListener("shopify:section:load", initForm);     function initForm(){     var formElement = document.querySelector('#how-did-you-hear-about-us');     var formError = document.querySelector('#how-did-you-hear-about-us--error');     var otherFormElement = document.querySelector('#how-did-you-hear-about-us-other');     var otherFormError = document.querySelector('#how-did-you-hear-about-us-other--error');     var otherFormWrapper = document.querySelector('#otherFormWrapper');     var checkoutButtons = document.querySelectorAll('[name="checkout"], [name="goto_pp"], [name="goto_gc"]');     function showOrHideForm(){         if (formElement.value == 'Other'){         otherFormWrapper.style.display = '';         } else {         otherFormWrapper.style.display = 'none';         }     }     function checkFormElement(){         if (formElement.value.length == 0){         formElement.classList.add('error');         formError.style.display = '';         } else {         if (formElement.classList.contains('error')){             formElement.classList.remove('error');             formError.style.display = 'none';         }         }     }     function checkOtherFormElement(){         if (otherFormElement.value.length == 0){         otherFormElement.classList.add('error');         otherFormError.style.display = '';         } else {         if (otherFormElement.classList.contains('error')){             otherFormElement.classList.remove('error');             otherFormError.style.display = 'none';         }         }     }     otherFormElement.addEventListener("input", function() {         {% if settings.hau_form_validation %}         checkOtherFormElement();         {% endif %}     });     formElement.addEventListener("change", function() {         showOrHideForm();         {% if settings.hau_form_validation %}         checkFormElement();         {% endif %}     });     checkoutButtons.forEach(function(element){         element.addEventListener("click", function(evt) {         {% if settings.hau_form_validation %}         var validated = true;         if (formElement.value.length == 0){             checkFormElement();             validated = false;         }         if (formElement.value == 'Other'){             if (otherFormElement.value.length == 0){             checkOtherFormElement();             validated = false;             }         }         if (!validated) {             evt.preventDefault();             evt.stopPropagation();         }         {% endif %}         });     });     } })() </script>
  2. Click Save.

ÎÄÕÂÄÚÈÝȪԴ£ºShopifyÉÌ»§¹Ù·½ÍøÕ¾


¸ü¶à
¡¾ÍøÕ¾µØÍ¼¡¿¡¾sitemap¡¿