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

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

shopifyÒþ²Ø¡°Ìí¼Óµ½¹ºÎï³µ¡±°´Å¥ÒÔ¼°Ä£°å·ÖÅɰ취

2022/03/04
×Ô½¨Õ¾

Òþ²Ø¡°Ìí¼Óµ½¹ºÎï³µ¡±°´Å¥

  1. ÔÚеĠproduct.requires-contact.liquid ÎļþÖУ¬ £¬£¬£¬ £¬£¬ £¬²éÕÒÌí¼Óµ½¹ºÎï³µ°´Å¥µÄ HTML ´úÂë¡£¡£¡£¡£¡£¡£¡£Äú¿ÉÒÔËÑË÷ cart Ò»´Ê¡£¡£¡£¡£¡£¡£¡£

    Ìí¼Óµ½¹ºÎï³µ°´Å¥µÄ´úÂëÒòÄ£°å¶øÒì¡£¡£¡£¡£¡£¡£¡£²éÕÒ°üÀ¨ Add to cart¡¢AddToCart »ò add-to-cart µÈÀàËÆÎı¾µÄ <input> »ò <button> ±ê¼Ç¡£¡£¡£¡£¡£¡£¡£

    ¹ØÓÚ Debut£¬ £¬£¬£¬ £¬£¬ £¬Ìí¼Óµ½¹ºÎï³µ°´Å¥µÄ´úÂëÈçÏÂËùʾ£º

<button type="submit" name="add" id="AddToCart-{{ section.id }}" {% unless current_variant.available %}disabled="disabled"{% endunless %} class="btn product-form__cart-submit{% if product.options.size == 1 and product.variants[0].title == 'Default Title' %} product-form__cart-submit--small{% endif %}">   <span id="AddToCartText-{{ section.id }}">     {% unless current_variant.available %}       {{ 'products.product.sold_out' | t }}     {% else %}       {{ 'products.product.add_to_cart' | t }}     {% endunless %}   </span> </button>
  1. ÕÒµ½´úÂëºó£¬ £¬£¬£¬ £¬£¬ £¬½«Ëü·ÅÈë Liquid {% comment %} ºÍ {% endcomment %} ±ê¼ÇÖ®¼ä¡£¡£¡£¡£¡£¡£¡£Õ⽫»á×èÖ¹¸Ã´úÂëÔÚÄúµÄÊÐËÁÖÐÏÔʾ£¬ £¬£¬£¬ £¬£¬ £¬µ«ÈôÊÇÄúÏëÉÔºó¸ü¸ÄÄúµÄÐÂÄ£°å£¬ £¬£¬£¬ £¬£¬ £¬Äú¿ÉÒÔÇáËɽ«Æä»Ö¸´¡£¡£¡£¡£¡£¡£¡£

    ¹ØÓÚ Debut£¬ £¬£¬£¬ £¬£¬ £¬Ð޸ĺóµÄ´úÂ뽫ÓëÏ·½ÀàËÆ£º

```liquid {% comment %} <button type="submit" name="add" id="AddToCart-{{ section.id }}" {% unless current_variant.available %}disabled="disabled"{% endunless %} class="btn product-form__cart-submit{% if product.options.size == 1 and product.variants[0].title == 'Default Title' %} product-form__cart-submit--small{% endif %}">   <span id="AddToCartText-{{ section.id }}">     {% unless current_variant.available %}       {{ 'products.product.sold_out' | t }}     {% else %}       {{ 'products.product.add_to_cart' | t }}     {% endunless %}   </span> </button> {% endcomment %}

×¢ÖØ

Make sure that you don't comment out the <form> tags for your product page. Your comment tags should not surround any <form> or </form> tags, otherwise customers might experience errors when viewing your product page. ``` 2. µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£

Ìí¼Óµç×ÓÓʼþÁ´½Ó»òÁªÏµ±í

ÄúÏÖÔÚÒÑÒþ²ØÁËÌí¼Óµ½¹ºÎï³µ°´Å¥£¬ £¬£¬£¬ £¬£¬ £¬¿ÉÒÔ¸ÄΪÌí¼ÓÒªÏÔʾµÄÄÚÈÝ¡£¡£¡£¡£¡£¡£¡£

µç×ÓÓʼþÁ´½Ó

  1. ÔÚÄúÉÏÒ»²½ÖÐÌí¼ÓµÄ Liquid {% endcomment %} ±ê¼ÇÏ·½µÄÐÂÐÐÖУ¬ £¬£¬£¬ £¬£¬ £¬Ìí¼Óµç×ÓÓʼþÁ´½ÓµÄ HTML ´úÂ룺

Please <a href="mailto:{{ shop.email }}">contact us</a> if you are interested in this product.
  1. µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£

ÁªÏµ±í

ÈôÊÇÒªÏòвúÆ·Ä£°åÖÐÌí¼ÓÁªÏµ±í£¬ £¬£¬£¬ £¬£¬ £¬Äú¿ÉÒÔ¸´ÖÆÄ£°åµÄÁªÏµÒ³ÃæÄ£°åÖеĴúÂë¡£¡£¡£¡£¡£¡£¡£ÈôÒªÌí¼ÓÁªÏµ±í£¬ £¬£¬£¬ £¬£¬ £¬ÇëÖ´ÐÐÒÔϲÙ×÷£º

  1. ÔÚ Templates Ä¿Â¼ÖУ¬ £¬£¬£¬ £¬£¬ £¬µã»÷ page.contact.liquid¡£¡£¡£¡£¡£¡£¡£

  2. ÔÚ¸ÃÎļþÖвéÕÒ Liquid {% form 'contact' %} ±ê¼Ç¡£¡£¡£¡£¡£¡£¡£

  3. ¸´ÖÆ´Ó Liquid {% form 'contact' %} ±ê¼ÇÏòϵ½ Liquid {% endform %} ±ê¼ÇµÄËùÓдúÂë¡£¡£¡£¡£¡£¡£¡£ÔÚ¸´ÖƵĴúÂëÖаüÀ¨ Liquid ±íµ¥±ê¼Ç¡£¡£¡£¡£¡£¡£¡£

  4. ·µ»Øµ½ Templates Ä¿Â¼ÖеÄРproduct.requires-contact.liquid Îļþ¡£¡£¡£¡£¡£¡£¡£

  5. ÔÚ¸ÃÎļþÖвéÕÒ¿¢Ê </form> ±ê¼Ç¡£¡£¡£¡£¡£¡£¡£ÔÚ¿¢Ê </form> ±ê¼ÇÏ·½µÄÐÂÐÐÖУ¬ £¬£¬£¬ £¬£¬ £¬Õ³ÌùÁªÏµ±íµÄ´úÂë¡£¡£¡£¡£¡£¡£¡£

  6. ÏÂÒ»²½Êǽ«Äú¸ÕÕ³ÌùµÄ´úÂë·ÅÈë HTML div ±ê¼ÇÖС£¡£¡£¡£¡£¡£¡£div ±ê¼Ç´úÂëÖаüÀ¨µÄÀàÊôÐÔ½«È·±£ÄúµÄÁªÏµ±í¿ÉÔÚÒ³ÃæÉÏ׼ȷ·ºÆð¡£¡£¡£¡£¡£¡£¡£

    ÔÚ {% form 'contact' %} ÉÏ·½µÄÐÂÐÐÖУ¬ £¬£¬£¬ £¬£¬ £¬Õ³ÌùÒÔÏ´úÂ룺

<div class="form-vertical"></div>

ÔÚ {% endform %} Ï·½µÄÐÂÐÐÖУ¬ £¬£¬£¬ £¬£¬ £¬Õ³ÌùÒÔÏ´úÂ룺

</div>
  1. µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£

½«ÐÂÄ£°å·ÖÅɸø²úÆ·

Ä£°åÏÖÒÑÍê³É£¬ £¬£¬£¬ £¬£¬ £¬Äú¿ÉÒÔ½«Ëü·ÖÅɸøÒª¶ÔÆäÒþ²ØÌí¼Óµ½¹ºÎï³µ°´Å¥µÄËùÓвúÆ·¡£¡£¡£¡£¡£¡£¡£

  1. ÔÚ Shopify ºǫ́ÖУ¬ £¬£¬£¬ £¬£¬ £¬×ªµ½²úÆ·¡£¡£¡£¡£¡£¡£¡£

  2. µã»÷ÄúÒª¶ÔÆäÒþ²ØÌí¼Óµ½¹ºÎï³µ°´Å¥µÄ²úÆ·µÄÃû³Æ¡£¡£¡£¡£¡£¡£¡£

  3. ÔÚ Shopify ºǫ́µÄ²úÆ·Ò³ÃæÉϵÄÔÚÏßÊÐËÁÏ£¬ £¬£¬£¬ £¬£¬ £¬´ÓÄ£°åÑùʽÏÂÀ­²Ëµ¥ÖÐÑ¡ÔñеĠrequires-contact Ä£°å¡£¡£¡£¡£¡£¡£¡£

  4. µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£

¶ÔÄúÒªÏòÆäÌí¼ÓÐÂÄ£°åµÄÿ¸ö²úÆ·ÖØ¸´ÕâЩ°ì·¨¡£¡£¡£¡£¡£¡£¡£

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

Hide the Add to cart button

  1. In your product-template-requires-contact.liquid section file, find the HTML code for the Product form of your product page. You can find it by searching for the word form in the file.

  2. When you find the code, wrap it in Liquid {% comment %} and {% endcomment %} tags. This will stop the code from being shown on your store, but will let you easily put it back if you want to change your new template later.

    For Narrative, the modified code would look like this:

    {% comment %} {% include 'product-form' %} {% endcomment %}
  3. Click Save.

Add an email link or contact form

Now that you have hidden the Add to cart button, you can add the content you want to show instead.

EMAIL LINK

You can add an email link that will open the customer's default email program and enter your store's customer-facing email address as the recipient. To add an email link:

  1. On a new line below the Liquid {% endcomment %} tag that you added in the last step, add the HTML code for an email link:

 <p>Please <a href="mailto:{{ shop.email }}">contact us</a> if you are interested in this product.</p>
  1. Click Save.

Contact form

You can add a contact form to your new product template by copying the code from your theme's contact page template. To add a contact form:

  1. In the Templates directory, click page.contact.liquid.

  2. Find the Liquid {% form 'contact' %} tag in the file.

  3. Copy all of the code from the Liquid {% form 'contact' %} tag down to the Liquid {% endform %} tag. Include the Liquid form tags in the code that you copy.

  4. Return to your new product.requires-contact.liquid file in the Templates directory.


On a new line below the Liquid {% endcomment %} tag that you added, paste the code for the contact form.

  1. The next step is to wrap the code that you just pasted in HTML div tags. The class attribute included in the div tag code will ensure that your contact form renders correctly on the page.

    On a new line above {% form 'contact' %}, paste the following code:

    <div class="form-vertical"></div>

    On a new line below {% endform %}, paste the following code:

      </div>
  2. Click Save.

Assign your new template to a product

Now that the template is finished, you can assign it to all of the products for which you want to hide the Add to cart button.

  1. From your Shopify admin, go to Products.

  2. Click the name of a product that you want to hide the Add to cart button on.

  3. On the product page of your Shopify admin, under Online store, choose your new requires-contact template from the Theme template drop-down menu.

  4. Click Save.

Repeat these steps for each product to which you want to add your new template.

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


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