shopifyÒþ²Ø¡°Ìí¼Óµ½¹ºÎï³µ¡±°´Å¥ÒÔ¼°Ä£°å·ÖÅɰ취
Òþ²Ø¡°Ìí¼Óµ½¹ºÎï³µ¡±°´Å¥
ÔÚеÄ
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>ÕÒµ½´úÂëºó£¬£¬£¬£¬£¬£¬£¬½«Ëü·ÅÈë 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. µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£
Ìí¼Óµç×ÓÓʼþÁ´½Ó»òÁªÏµ±í
ÄúÏÖÔÚÒÑÒþ²ØÁËÌí¼Óµ½¹ºÎï³µ°´Å¥£¬£¬£¬£¬£¬£¬£¬¿ÉÒÔ¸ÄΪÌí¼ÓÒªÏÔʾµÄÄÚÈÝ¡£¡£¡£¡£¡£¡£¡£
µç×ÓÓʼþÁ´½Ó
ÔÚÄúÉÏÒ»²½ÖÐÌí¼ÓµÄ Liquid
{% endcomment %}±ê¼ÇÏ·½µÄÐÂÐÐÖУ¬£¬£¬£¬£¬£¬£¬Ìí¼Óµç×ÓÓʼþÁ´½ÓµÄ HTML ´úÂ룺
Please <a href="mailto:{{ shop.email }}">contact us</a> if you are interested in this product.µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£
ÁªÏµ±í
ÈôÊÇÒªÏòвúÆ·Ä£°åÖÐÌí¼ÓÁªÏµ±í£¬£¬£¬£¬£¬£¬£¬Äú¿ÉÒÔ¸´ÖÆÄ£°åµÄÁªÏµÒ³ÃæÄ£°åÖеĴúÂë¡£¡£¡£¡£¡£¡£¡£ÈôÒªÌí¼ÓÁªÏµ±í£¬£¬£¬£¬£¬£¬£¬ÇëÖ´ÐÐÒÔϲÙ×÷£º
ÔÚ Templates Ŀ¼ÖУ¬£¬£¬£¬£¬£¬£¬µã»÷
page.contact.liquid¡£¡£¡£¡£¡£¡£¡£ÔÚ¸ÃÎļþÖвéÕÒ Liquid
{% form 'contact' %}±ê¼Ç¡£¡£¡£¡£¡£¡£¡£¸´ÖÆ´Ó Liquid
{% form 'contact' %}±ê¼ÇÏòϵ½ Liquid{% endform %}±ê¼ÇµÄËùÓдúÂë¡£¡£¡£¡£¡£¡£¡£ÔÚ¸´ÖƵĴúÂëÖаüÀ¨ Liquid ±íµ¥±ê¼Ç¡£¡£¡£¡£¡£¡£¡£·µ»Øµ½ Templates Ŀ¼ÖеÄÐÂ
product.requires-contact.liquidÎļþ¡£¡£¡£¡£¡£¡£¡£ÔÚ¸ÃÎļþÖвéÕÒ¿¢ÊÂ
</form>±ê¼Ç¡£¡£¡£¡£¡£¡£¡£ÔÚ¿¢ÊÂ</form>±ê¼ÇÏ·½µÄÐÂÐÐÖУ¬£¬£¬£¬£¬£¬£¬Õ³ÌùÁªÏµ±íµÄ´úÂë¡£¡£¡£¡£¡£¡£¡£ÏÂÒ»²½Êǽ«Äú¸ÕÕ³ÌùµÄ´úÂë·ÅÈë HTML div ±ê¼ÇÖС£¡£¡£¡£¡£¡£¡£div ±ê¼Ç´úÂëÖаüÀ¨µÄÀàÊôÐÔ½«È·±£ÄúµÄÁªÏµ±í¿ÉÔÚÒ³ÃæÉÏ׼ȷ·ºÆð¡£¡£¡£¡£¡£¡£¡£
ÔÚ
{% form 'contact' %}ÉÏ·½µÄÐÂÐÐÖУ¬£¬£¬£¬£¬£¬£¬Õ³ÌùÒÔÏ´úÂ룺
<div class="form-vertical"></div>
ÔÚ {% endform %} Ï·½µÄÐÂÐÐÖУ¬£¬£¬£¬£¬£¬£¬Õ³ÌùÒÔÏ´úÂ룺
</div>
µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£
½«ÐÂÄ£°å·ÖÅɸø²úÆ·
Ä£°åÏÖÒÑÍê³É£¬£¬£¬£¬£¬£¬£¬Äú¿ÉÒÔ½«Ëü·ÖÅɸøÒª¶ÔÆäÒþ²ØÌí¼Óµ½¹ºÎï³µ°´Å¥µÄËùÓвúÆ·¡£¡£¡£¡£¡£¡£¡£
ÔÚ Shopify ºǫ́ÖУ¬£¬£¬£¬£¬£¬£¬×ªµ½²úÆ·¡£¡£¡£¡£¡£¡£¡£
µã»÷ÄúÒª¶ÔÆäÒþ²ØÌí¼Óµ½¹ºÎï³µ°´Å¥µÄ²úÆ·µÄÃû³Æ¡£¡£¡£¡£¡£¡£¡£
ÔÚ Shopify ºǫ́µÄ²úÆ·Ò³ÃæÉϵÄÔÚÏßÊÐËÁÏ£¬£¬£¬£¬£¬£¬£¬´ÓÄ£°åÑùʽÏÂÀ²Ëµ¥ÖÐÑ¡ÔñÐ嵀 requires-contact Ä£°å¡£¡£¡£¡£¡£¡£¡£
µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£
¶ÔÄúÒªÏòÆäÌí¼ÓÐÂÄ£°åµÄÿ¸ö²úÆ·ÖØ¸´ÕâЩ°ì·¨¡£¡£¡£¡£¡£¡£¡£
ShopifyÉÌ»§¹ÙÍøÔÎÄÏêÇ飺
Hide the Add to cart button
In your
product-template-requires-contact.liquidsection file, find the HTML code for the Product form of your product page. You can find it by searching for the wordformin the file.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 %}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:
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>
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:
In the Templates directory, click
page.contact.liquid.Find the Liquid
{% form 'contact' %}tag in the file.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.Return to your new
product.requires-contact.liquidfile in the Templates directory.
On a new line below the Liquid
{% endcomment %}tag that you added, paste the code for the contact form.
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>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.
From your Shopify admin, go to Products.
Click the name of a product that you want to hide the Add to cart button on.
On the product page of your Shopify admin, under Online store, choose your new requires-contact template from the Theme template drop-down menu.
Click Save.
Repeat these steps for each product to which you want to add your new template.
ÎÄÕÂÄÚÈÝȪԴ£ºShopifyÉÌ»§¹Ù·½ÍøÕ¾
- 1ËÙÂôͨÂô¼Ò¿ªµêÐèÒªÌáǰ·Å¿îÐèÒª¶à¾Ã
- 2ÑÇÂíÑ·Âô¼ÒÔõÑù½¨Éè±äÌå
- 3ÔõÑùʹÓÃ×ÔÁ¦Õ¾¿ªÍØÈðµä¿ç¾³Êг¡£¡£¡£¡£¡£¡£¡£¿£¿£¿£¿£¿£¿£¿£¿
- 4ÍâóµçÉÌ´ÓÄÇÀïѧÆð£¿£¿£¿£¿£¿£¿£¿£¿
- 5¿ç¾³µçÉÌ´ò°ç¸¨Áϳö¿ÚÐèÒª×¢ÖØÄÄЩÊÂÏî
- 6ÑÇÂíÑ·³£ÓÃÊý¾ÝÕûÀí¹«Ê½ÓÐÄÄЩ
- 7¹ØÓÚFRS£¬£¬£¬£¬£¬£¬£¬ÄãÒ»¶¨ÒªÖªµÀµÄÊÂÇ飡
- 8Ó°ÏìÑÇÂíÑ·¶¯Ì¬ÊÕ¼µÄÖ÷ÒªÒòËØ
- 9³ö¿Ú¿ç¾³µçÉÌÖ÷Ҫƽ̨ÆÊÎö
- 10ÔõÑùÆÊÎöebayµÄ²úÆ·Êý¾Ý