ÔÚshopify²úÆ·Ò³ÃæÉÑþ³Øý»ò½ûÓÃÊÛóÀµÄ¶àÊôÐÔ°ì·¨
Òþ²ØÊÛóÀ¶àÊôÐÔ
±¸×¢
ÈôÊÇÄúʹÓà Shopify µÄÃâ·ÑÄ£°å£¬£¬£¬£¬£¬£¬£¬£¬Äú¿ÉÒÔÁªÏµ Shopify Ö§³ÖÍŶӻñµÃ¹ØÓڴ˽̵̳Ä×ÊÖú¡£¡£¡£¡£¡£¡£¡£¡£´Ë½Ì³ÌÐèÒª 15 ·ÖÖÓµÄÉè¼ÆÊ±¼ä¡£¡£¡£¡£¡£¡£¡£¡£ÈôÒªÏàʶÏêÇ飬£¬£¬£¬£¬£¬£¬£¬Çë²ÎÔÄ Support for themes¡£¡£¡£¡£¡£¡£¡£¡£
±¸×¢
´Ë×Ô½ç˵ÓÃÓÚ¸´¹Å Shopify Ä£°å£¬£¬£¬£¬£¬£¬£¬£¬²»ÊÊÓÃÓÚ¡°Online Store 2.0¡±Ä£°å¡£¡£¡£¡£¡£¡£¡£¡£
ÕÒµ½ÄúµÄÄ£°å¼Ü¹¹°æ±¾
̽Ë÷¡°Online Store 2.0¡±Ä£°å×Ô½ç˵
Äú¿ÉÒÔͨ¹ýÔÚ²úÆ·Ò³ÃæÉÑþ³Øý»ò½ûÓÃÊÛóÀµÄ¶àÊôÐÔÀ´×èÖ¹¿Í»§Ñ¡ÔñÕâЩ¶àÊôÐÔ¡£¡£¡£¡£¡£¡£¡£¡£
±¾Ò³Ïà¹ØÖ÷Ìâ
ÏÞÖÆ
Ñ¡ÔñÄúµÄÄ£°å
ÏÞÖÆ
´ËÒ³ÃæÖиÅÊöµÄ×Ô½ç˵ÉèÖò»ÊÊÓÃÓÚÒÔÏÂÇéÐΣº
ÄúµÄ²úÆ·Óжà¸ö²úÆ·Ñ¡Ïî
ÄúʹÓà Express Ä£°å£¬£¬£¬£¬£¬£¬£¬£¬²¢½«²úÆ·Ò³ÃæÉèÖÃΪÒÔµþ¼Ó·½·¨ÏÔʾ²úÆ·
·ÖÇøÄ£°åºÍδ·ÖÇøÄ£°å
±¸×¢£º±¾½Ì³ÌµÄ°ì·¨½«Æ¾Ö¤ÄúʹÓõÄÊÇ·ÖÇøÄ£°åÕÕ¾Éδ·ÖÇøÄ£°å¶øÓÐËù²î±ð¡£¡£¡£¡£¡£¡£¡£¡£·ÖÇøÄ£°åÖ§³Öͨ¹ýÍÏ·ÅÀ´°²ÅÅÖ÷Ò³µÄ½á¹¹£¬£¬£¬£¬£¬£¬£¬£¬Î´·ÖÇøÄ£°åÔò²»Ö§³Ö¡£¡£¡£¡£¡£¡£¡£¡£
ÈôÊÇÏëÏàʶÄúµÄÄ£°åÊÇ·ñÖ§³Ö·ÖÇø£¬£¬£¬£¬£¬£¬£¬£¬Çëתµ½Ä£°åµÄ±à¼´úÂëÒ³Ãæ¡£¡£¡£¡£¡£¡£¡£¡£ÈôÊÇ Sections Ŀ¼ÖÐÓÐÎļþ£¬£¬£¬£¬£¬£¬£¬£¬ÄúÔòÕýÔÚʹÓÃÒÑ·ÖÇøÄ£°å¡£¡£¡£¡£¡£¡£¡£¡£Î´·ÖÇøÄ£°åÊÇÔÚ 2016 Äê 10 ÔÂ֮ǰÐû²¼µÄ£¬£¬£¬£¬£¬£¬£¬£¬²¢ÇÒ Sections Ŀ¼ÖÐûÓÐÎļþ¡£¡£¡£¡£¡£¡£¡£¡£
ÈôÊÇÄúʹÓÃÒÑ·ÖÇøÄ£°å£¬£¬£¬£¬£¬£¬£¬£¬Çëµã»÷ Sectioned themes£¨ÒÑ·ÖÇøÄ£°å£©°´Å¥²¢Æ¾Ìý˵Ã÷¾ÙÐвÙ×÷¡£¡£¡£¡£¡£¡£¡£¡£ÈôÊÇÄúʹÓýϾɵÄδ·ÖÇøÄ£°å£¬£¬£¬£¬£¬£¬£¬£¬Çëµã»÷ Non-sectioned themes£¨Î´·ÖÇøÄ£°å£©°´Å¥²¢Æ¾Ìý˵Ã÷¾ÙÐвÙ×÷¡£¡£¡£¡£¡£¡£¡£¡£
Sectioned themes
Non-sectioned themes
Ñ¡ÔñÄúµÄÄ£°å
´Ë×Ô½ç˵µÄ°ì·¨ÒòÄúµÄÄ£°å¶øÒì¡£¡£¡£¡£¡£¡£¡£¡£µã»÷Ä£°åµÄ°´Å¥£¬£¬£¬£¬£¬£¬£¬£¬È»ºóƾ֤ÒÔÏÂ˵Ã÷²Ù×÷£º
Boundless
Brooklyn
Debut
Express
Minimal
Narrative
Simple
Supply
Venture
Boundless
´Ë×Ô½ç˵ÉèÖõİ취ȡ¾öÓÚÄúÊÇÏ£ÍûÍêÈ«Òþ²ØÊÛóÀµÄ¶àÊôÐÔ£¬£¬£¬£¬£¬£¬£¬£¬ÕÕ¾ÉÖ»Ï뽫Æä½ûÓᣡ£¡£¡£¡£¡£¡£¡£µã»÷Æ«ºÃÉèÖð´Å¥£¬£¬£¬£¬£¬£¬£¬£¬È»ºóƾ֤ÒÔÏÂ˵Ã÷²Ù×÷£º
Disable
Òþ²ØÊÛóÀ¶àÊôÐÔ
ƾ֤ÒÔϰ취½«×Ô½ç˵ÏîÓ¦ÓÃÓÚ Boundless£º
PC£º
ÔÚ Shopify ºǫ́ÖУ¬£¬£¬£¬£¬£¬£¬£¬×ªµ½ÔÚÏßÊÐËÁ > Ä£°å¡£¡£¡£¡£¡£¡£¡£¡£
ÕÒµ½Òª±à¼µÄÄ£°å£¬£¬£¬£¬£¬£¬£¬£¬È»ºóµã»÷²Ù×÷ > ±à¼´úÂë¡£¡£¡£¡£¡£¡£¡£¡£
ÔÚ Assets Ŀ¼ÖУ¬£¬£¬£¬£¬£¬£¬£¬µã»÷
theme.js»òtheme.js.liquid¡£¡£¡£¡£¡£¡£¡£¡£
Æ»¹ûϵͳ£º
ÔÚ Shopify Ó¦ÓÃÖУ¬£¬£¬£¬£¬£¬£¬£¬Çá´¥ÊÐËÁ¡£¡£¡£¡£¡£¡£¡£¡£
ÔÚÏúÊÛÇþµÀ²¿·ÖÖУ¬£¬£¬£¬£¬£¬£¬£¬Çá´¥ÔÚÏßÊÐËÁ¡£¡£¡£¡£¡£¡£¡£¡£
Çá´¥ Manage themes£¨ÖÎÀíÄ£°å£©¡£¡£¡£¡£¡£¡£¡£¡£
ÕÒµ½Òª±à¼µÄÄ£°å£¬£¬£¬£¬£¬£¬£¬£¬È»ºóµã»÷²Ù×÷ > ±à¼´úÂë¡£¡£¡£¡£¡£¡£¡£¡£
ÔÚ Assets Ŀ¼ÖУ¬£¬£¬£¬£¬£¬£¬£¬µã»÷
theme.js»òtheme.js.liquid¡£¡£¡£¡£¡£¡£¡£¡£
°²×¿ÏµÍ³£º
ÔÚ Shopify Ó¦ÓÃÖУ¬£¬£¬£¬£¬£¬£¬£¬Çá´¥ÊÐËÁ¡£¡£¡£¡£¡£¡£¡£¡£
ÔÚÏúÊÛÇþµÀ²¿·ÖÖУ¬£¬£¬£¬£¬£¬£¬£¬Çá´¥ÔÚÏßÊÐËÁ¡£¡£¡£¡£¡£¡£¡£¡£
Çá´¥ Manage themes£¨ÖÎÀíÄ£°å£©¡£¡£¡£¡£¡£¡£¡£¡£
ÕÒµ½Òª±à¼µÄÄ£°å£¬£¬£¬£¬£¬£¬£¬£¬È»ºóµã»÷²Ù×÷ > ±à¼´úÂë¡£¡£¡£¡£¡£¡£¡£¡£
ÔÚ Assets Ŀ¼ÖУ¬£¬£¬£¬£¬£¬£¬£¬µã»÷
theme.js»òtheme.js.liquid¡£¡£¡£¡£¡£¡£¡£¡£
ÔÚÎļþµ×²¿£¬£¬£¬£¬£¬£¬£¬£¬Õ³ÌùÒÔÏ´úÂ룺
document.addEventListener('DOMContentLoaded', function() { const productJson = document.querySelectorAll('[id`^`=ProductJson-'); if (productJson.length > 0) { for (let i = 0; i < productJson.length; i++) { const current = productJson[i]; const sectionId = current.id.replace('ProductJson-', ''); const section = document.querySelector('[data-section-id="' + sectionId + '"]'); const product = JSON.parse(current.text); if (product.options.length === 1) { const unavailableVariants = []; for (let j = 0; j < product.variants.length; j++) { const variant = product.variants[j]; if (!variant.available) { unavailableVariants.push(variant); } } if (unavailableVariants.length > 0) { const mutationCallback = function() { const variantOptions = section.querySelectorAll('.single-option-selector option'); if (variantOptions.length > 0) { for (let k = 0; k < unavailableVariants.length; k++) { const unavailableVariant = unavailableVariants[k]; for (let l = 0; l < variantOptions.length; l++) { const option = variantOptions[l]; if (unavailableVariant.title === option.value) { option.remove(); } } } if (typeof observer === 'object' && typeof observer.disconnect === 'function') { observer.disconnect(); } } } const observer = new MutationObserver(mutationCallback); const addToCartForm = document.querySelector('form[action*="/cart/add"]'); mutationCallback(); if (window.MutationObserver && addToCartForm.length) { const config = { childList: true, subtree: true }; if (typeof observer === 'object' && typeof observer.disconnect === 'function') { observer.disconnect(); } observer.observe(addToCartForm, config); } } } } } });µã»÷ÉúÑÄ¡£¡£¡£¡£¡£¡£¡£¡£
ShopifyÉÌ»§¹ÙÍøÔÎÄÏêÇ飺
Hide sold-out variants
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 prevent customers from selecting sold-out variants by removing or disabling those variants on the product page.
On this page
Limitations
Select your theme
Limitations
The customizations outlined on this page do not work for the following cases:
Your products have more than one product option
You use the Express theme and have the product page set to show products in an overlay
Sectioned and non-sectioned themes
Note
The steps for this tutorial differ depending on whether you are using a sectioned or a non-sectioned theme. A sectioned theme lets you drag and drop to arrange the layout of your home page, and a non-sectioned theme doesn't.
To figure out whether your theme supports sections, go to the theme's Edit code page. If there are files in the Sections directory, you are using a sectioned theme. Non-sectioned themes were released before October 2016, and do not have files in the Sections directory.
If you are using a sectioned theme, click the Sectioned themes button and follow the instructions. If you are using an older, non-sectioned theme, click the Non-sectioned themes button and follow the instructions.
Sectioned themes
Non-sectioned themes
Select your theme
The steps for this customization vary depending on your theme. Click the button for your theme before following the instructions below:
Boundless
Brooklyn
Debut
Express
Minimal
Narrative
Simple
Supply
Venture
Boundless
The steps for this customization vary depending on whether you want to completely hide sold-out variants, or just disable them. Click the button for your preference before following the instructions below:
Hide
Disable
Hide sold-out variants
Follow these steps to apply the customization to Boundless:
PC£º
From your Shopify admin, go to Online Store > Themes.
Find the theme you want to edit, and then click Actions > Edit code.
In the Assets directory, click
theme.jsortheme.js.liquid.iPhone£º
From the Shopify app, tap Store.
In the Sales channels section, tap Online Store.
Tap Manage themes.
Find the theme you want to edit, and then click Actions > Edit code.
In the Assets directory, click
theme.jsortheme.js.liquid.Android£º
From the Shopify app, tap Store.
In the Sales channels section, tap Online Store.
Tap Manage themes.
Find the theme you want to edit, and then click Actions > Edit code.
In the Assets directory, click
theme.jsortheme.js.liquid.
At the bottom of the file, paste the following code:
document.addEventListener('DOMContentLoaded', function() { const productJson = document.querySelectorAll('[id^=ProductJson-');if (productJson.length > 0) { for (let i = 0; i < productJson.length; i++) { const current = productJson[i]; const sectionId = current.id.replace('ProductJson-', ''); const section = document.querySelector('[data-section-id="' + sectionId + '"]'); const product = JSON.parse(current.text);if (product.options.length === 1) { const unavailableVariants = [];for (let j = 0; j < product.variants.length; j++) { const variant = product.variants[j];if (!variant.available) { unavailableVariants.push(variant); } }if (unavailableVariants.length > 0) { const mutationCallback = function() { const variantOptions = section.querySelectorAll('.single-option-selector option');if (variantOptions.length > 0) { for (let k = 0; k < unavailableVariants.length; k++) { const unavailableVariant = unavailableVariants[k];for (let l = 0; l < variantOptions.length; l++) { const option = variantOptions[l];if (unavailableVariant.title === option.value) { option.remove(); } } }if (typeof observer === 'object' && typeof observer.disconnect === 'function') { observer.disconnect(); } } }const observer = new MutationObserver(mutationCallback); const addToCartForm = document.querySelector('form[action*="/cart/add"]');mutationCallback();if (window.MutationObserver && addToCartForm.length) { const config = { childList: true, subtree: true };if (typeof observer === 'object' && typeof observer.disconnect === 'function') { observer.disconnect(); }observer.observe(addToCartForm, config); } } } } } });Click Save.
ÎÄÕÂÄÚÈÝȪԴ£ºShopifyÉÌ»§¹Ù·½ÍøÕ¾
ÉÏһƪ£ºShopify¿ªµêÁ÷³Ì¼°ÕË»§×¢²áȫָÄÏ
ÏÂһƪ£ºshopifyÊÐËÁÒþ²Ø²úÆ·¼ÛÇ®°ì·¨
- 1ÑÇÂíÑ·Âô¼ÒÔõÑùÌîд´ÙÏúÔ˶¯ÐÅÏ¢£¿£¿£¿£¿£¿£¿
- 2µÂ¹úVAT˰ºÅÒ»ÄêÓöȵÄÖ÷ÒªÐÔÓë×é³É£ºÈ·±£Ë°ÎñºÏ¹æÓë²ÆÎñ¿ÉÒ»Á¬ÐÔ
- 3ÔõÑù³ÉΪÑÇÂíÑ·BSET SELLER
- 4ShopifyÉèÖÃÍâµØ·¢»õ½Ì³Ì
- 5ìî³ýÒ»¶þÐÇÆÀ·Ö£¡Õâ벬½ðÂô¼Ò3Õи㶨£¡
- 6¿ç¾³µçÉÌÎïÁ÷״̬µÄ֪ͨÓʼþ·¶ÎÄ
- 7ϺƤ¹Ù·½½â´ð£ºÎªÊ²Ã´ShopeeÕÊ»§±»¶³½áÁË£¿£¿£¿£¿£¿£¿
- 8ÔÚÑÇÂíÑ·É̳ǣ¬£¬£¬£¬£¬£¬£¬£¬ÄÄЩÓйØÓÚ¶¯ÎïµÄÉÌÆ·¿ÉÒÔÏúÊÛ£¿£¿£¿£¿£¿£¿ÄÄЩ²»¿ÉÒÔ£¿£¿£¿£¿£¿£¿
- 9ebay ÍâÑó²ÖÎïÁ÷ÒªÔõôÉèÖòźã¿£¿£¿£¿£¿£¿
- 10ÖÎÀíºÍÓÅ»¯AdWords¹ã¸æ