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

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

shopify²úÆ·ÏÔʾ SKU ±àºÅºÍÌí¼ÓSKU±àºÅ°ì·¨

shopifyÊÐËÁSKU ±àºÅ
2022/03/04
×Ô½¨Õ¾

ÔÚ²úÆ·Ò³ÃæÉÏÏÔʾ SKU ±àºÅ


±¸×¢

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

±¸×¢

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

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

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


SKU£¨»õºÅ£©ÓÉÊý×Ö£¨Í¨³£ÊÇ×ÖĸÊý×Ö£©×é³É£¬£¬£¬£¬£¬£¬£¬ £¬ÓÃÓÚ×ÊÖúʶ±ð²úÆ·ºÍ¸ú×Ù¿â´æ ¡£¡£¡£¡£¡£ÈôÊÇÊÐËÁʹÓà SKU£¬£¬£¬£¬£¬£¬£¬ £¬Ôòÿ¸öµ¥¶ÀµÄ²úÆ·¶àÊôÐÔ¶¼»á·ÖÅɵ½Î¨Ò»µÄ±àºÅ ¡£¡£¡£¡£¡£Äú¿ÉÒÔͨ¹ý±à¼­Ä£°å´úÂëÀ´ÔÚ²úÆ·Ò³ÃæÉÏÏÔʾ¶àÊôÐ﵀ SKU ±àºÅ£º


·ÖÇøÄ£°åºÍδ·ÖÇøÄ£°å

±¸×¢£º±¾½Ì³ÌµÄ°ì·¨½«Æ¾Ö¤ÄúʹÓõÄÊÇ·ÖÇøÄ£°åÕÕ¾Éδ·ÖÇøÄ£°å¶øÓÐËù²î±ð ¡£¡£¡£¡£¡£·ÖÇøÄ£°åÖ§³Öͨ¹ýÍÏ·ÅÀ´°²ÅÅÖ÷Ò³µÄ½á¹¹£¬£¬£¬£¬£¬£¬£¬ £¬Î´·ÖÇøÄ£°åÔò²»Ö§³Ö ¡£¡£¡£¡£¡£

ÈôÊÇÏëÏàʶÄúµÄÄ£°åÊÇ·ñÖ§³Ö·ÖÇø£¬£¬£¬£¬£¬£¬£¬ £¬Çëתµ½Ä£°åµÄ±à¼­´úÂëÒ³Ãæ ¡£¡£¡£¡£¡£ÈôÊÇ Sections Ä¿Â¼ÖÐÓÐÎļþ£¬£¬£¬£¬£¬£¬£¬ £¬ÄúÔòÕýÔÚʹÓÃÒÑ·ÖÇøÄ£°å ¡£¡£¡£¡£¡£Î´·ÖÇøÄ£°åÊÇÔÚ 2016 Äê 10 ÔÂ֮ǰÐû²¼µÄ£¬£¬£¬£¬£¬£¬£¬ £¬²¢ÇÒ Sections Ä¿Â¼ÖÐûÓÐÎļþ ¡£¡£¡£¡£¡£

ÈôÊÇÄúʹÓÃÒÑ·ÖÇøÄ£°å£¬£¬£¬£¬£¬£¬£¬ £¬Çëµã»÷ Sectioned themes£¨ÒÑ·ÖÇøÄ£°å£©°´Å¥²¢Æ¾Ìý˵Ã÷¾ÙÐвÙ×÷ ¡£¡£¡£¡£¡£ÈôÊÇÄúʹÓýϾɵÄδ·ÖÇøÄ£°å£¬£¬£¬£¬£¬£¬£¬ £¬Çëµã»÷ Non-sectioned themes£¨Î´·ÖÇøÄ£°å£©°´Å¥²¢Æ¾Ìý˵Ã÷¾ÙÐвÙ×÷ ¡£¡£¡£¡£¡£

  • Sectioned themes

  •  

  • Non-sectioned themes

±¾Ò³Ïà¹ØÖ÷Ìâ

  • ÔÚ²úÆ·Ò³ÃæÉÏÏÔʾ SKU ±àºÅ

  • ´Óºǫ́Ïò²úÆ·¶àÊôÐÔÌí¼Ó SKU ±àºÅ

ÔÚ²úÆ·Ò³ÃæÉÏÏÔʾ SKU ±àºÅ

ÈôÒª±à¼­ÄúµÄÄ£°åÒÔÔÚ²úÆ·Ò³ÃæÉÏÏÔʾ SKU ±àºÅ£¬£¬£¬£¬£¬£¬£¬ £¬ÇëÖ´ÐÐÒÔϲÙ×÷£º

PC£º

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

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

  1. ÔÚ Sections Ä¿Â¼ÖУ¬£¬£¬£¬£¬£¬£¬ £¬µã»÷ product.liquid »ò product-template.liquid ¡£¡£¡£¡£¡£

  2. ²éÕÒÒÔÏ Liquid ±ê¼Ç£º

{{ product.title }}

ÕâÊÇÔÚ²úÆ·Ò³ÃæÉÏ·ºÆð²úÆ·ÎÊÌâµÄ´úÂë ¡£¡£¡£¡£¡£

  1. ÔÚ°üÀ¨ {{ product.title }} µÄ´úÂëÐÐÏ·½µÄÐÂÐÐÖУ¬£¬£¬£¬£¬£¬£¬ £¬Õ³ÌùÒÔÏ´úÂ룺

{% assign current_variant = product.selected_or_first_available_variant %} <span>{{ current_variant.sku }}</span>
  1. µã»÷ÉúÑÄ ¡£¡£¡£¡£¡£

Æ»¹ûϵͳ£º

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

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

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

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

  1. ÔÚ Sections Ä¿Â¼ÖУ¬£¬£¬£¬£¬£¬£¬ £¬µã»÷ product.liquid »ò product-template.liquid ¡£¡£¡£¡£¡£

  2. ²éÕÒÒÔÏ Liquid ±ê¼Ç£º

{{ product.title }}

ÕâÊÇÔÚ²úÆ·Ò³ÃæÉÏ·ºÆð²úÆ·ÎÊÌâµÄ´úÂë ¡£¡£¡£¡£¡£

  1. ÔÚ°üÀ¨ {{ product.title }} µÄ´úÂëÐÐÏ·½µÄÐÂÐÐÖУ¬£¬£¬£¬£¬£¬£¬ £¬Õ³ÌùÒÔÏ´úÂ룺

{% assign current_variant = product.selected_or_first_available_variant %} <span>{{ current_variant.sku }}</span>
  1. µã»÷ÉúÑÄ ¡£¡£¡£¡£¡£

°²×¿ÏµÍ³£º

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

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

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

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

  1. ÔÚ Sections Ä¿Â¼ÖУ¬£¬£¬£¬£¬£¬£¬ £¬µã»÷ product.liquid »ò product-template.liquid ¡£¡£¡£¡£¡£

  2. ²éÕÒÒÔÏ Liquid ±ê¼Ç£º

{{ product.title }}

ÕâÊÇÔÚ²úÆ·Ò³ÃæÉÏ·ºÆð²úÆ·ÎÊÌâµÄ´úÂë ¡£¡£¡£¡£¡£

  1. ÔÚ°üÀ¨ {{ product.title }} µÄ´úÂëÐÐÏ·½µÄÐÂÐÐÖУ¬£¬£¬£¬£¬£¬£¬ £¬Õ³ÌùÒÔÏ´úÂ룺

{% assign current_variant = product.selected_or_first_available_variant %} <span>{{ current_variant.sku }}</span>
  1. µã»÷ÉúÑÄ ¡£¡£¡£¡£¡£

Ñ¡ÔñÄúµÄÄ£°å

´Ë×Ô½ç˵ÉèÖõĺóÐø°ì·¨ÒòÄúµÄÄ£°å¶øÒì ¡£¡£¡£¡£¡£µã»÷Ä£°åµÄ°´Å¥£¬£¬£¬£¬£¬£¬£¬ £¬È»ºóƾÌý˵Ã÷²Ù×÷ ¡£¡£¡£¡£¡£

Boundless °ì·¨

  1. ÔÚ Assets Ä¿Â¼ÖУ¬£¬£¬£¬£¬£¬£¬ £¬µã»÷ theme.js.liquid ¡£¡£¡£¡£¡£

  2. ²éÕÒ variant.sku ¡£¡£¡£¡£¡£

    ÈôÊÇÄúÄܹ»ÕÒµ½ variant.sku£¬£¬£¬£¬£¬£¬£¬ £¬ÔòÌåÏÖÄúÒÑÍê³É×Ô½ç˵ÉèÖà ¡£¡£¡£¡£¡£

    ÈôÊÇÄúÕÒ²»µ½ variant.sku£¬£¬£¬£¬£¬£¬£¬ £¬Çë¼ÌÐø¾ÙÐÐÏÂÒ»²½ ¡£¡£¡£¡£¡£

  3. ÔÚÎļþµ×²¿£¬£¬£¬£¬£¬£¬£¬ £¬Õ³ÌùÒÔÏ´úÂ룺

document.addEventListener('DOMContentLoaded', () => {   setTimeout(function() {     const productJson = [...document.querySelectorAll('[id^=ProductJson-')];     if (productJson.length > 0) {       productJson.forEach((product) => {         const sectionId = product.id.replace("ProductJson-", "shopify-section-");         const variantSKU = document.querySelector('#' + sectionId + ' .variant-sku');         const inputSelects = [...document.querySelectorAll('#' + sectionId + ' .single-option-selector')];         const productInfo = JSON.parse(product.innerHTML);         const inputValues = [];         const optionValues = [];         let count = 0;         inputSelects.forEach((input) => {           inputValues.push(input.value);           optionValues.push(count);           input.addEventListener('change', (evt) => {             const currentValue = evt.currentTarget.value.toString();             const changedIndex = inputSelects.indexOf(evt.target);             inputValues[changedIndex] = currentValue;             variantSKU.innerText = ' ';             productInfo.variants.forEach((variant) => {               if (JSON.stringify(variant.options) == JSON.stringify(inputValues)) {                 variantSKU.innerText = variant.sku;               }             });           });           count += 1;         });       });     }   }, 100); });
  1. µã»÷ÉúÑÄ ¡£¡£¡£¡£¡£

´Óºǫ́Ïò²úÆ·¶àÊôÐÔÌí¼Ó SKU ±àºÅ

ÈôÒªÔÚ²úÆ·Ò³ÃæÉÏÏÔʾ SKU£¬£¬£¬£¬£¬£¬£¬ £¬Äú±ØÐè´Ó Shopify ºǫ́Ïò²úÆ·¶àÊôÐÔÌí¼Ó SKU ±àºÅ ¡£¡£¡£¡£¡£

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

  2. µã»÷ÄúÒª±à¼­µÄ²úÆ· ¡£¡£¡£¡£¡£

  3. ¹ØÓÚ¾ßÓжà¸ö¶àÊôÐԵIJúÆ·£¬£¬£¬£¬£¬£¬£¬ £¬ÇëÔÚ¶àÊôÐÔ·ÖÇøÖÐÌí¼Ó SKU ±àºÅ£º

  1. ¹ØÓÚûÓжàÊôÐԵIJúÆ·£¬£¬£¬£¬£¬£¬£¬ £¬ÇëÔÚ¿â´æ·ÖÇøÖÐÌí¼Ó SKU ±àºÅ£º

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

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

Show SKU numbers on product pages


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


SKUs (stock keeping units) are numbers, typically alphanumeric, that are used to help identify products and track inventory. If a store uses SKUs, then a unique number is assigned to each individual product variant. You can show SKU numbers for variants on your product pages by editing your theme code:

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

On this page

  • Show SKU numbers on product pages

  • Add SKU numbers to your product variants from the admin

Show SKU numbers on product pages

To edit your theme to show SKU numbers on product pages:

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 Sections directory, click product.liquid or product-template.liquid.

  2. Find the following Liquid tag:

    {{ product.title }}

    This is the code that renders your product titles on the product page.

  3. On a new line below the line of code that includes {{ product.title }}, paste the following code:

    {% assign current_variant = product.selected_or_first_available_variant %} <span>{{ current_variant.sku }}</span>
  4. Click Save.

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 Sections directory, click product.liquid or product-template.liquid.

  2. Find the following Liquid tag:

    {{ product.title }}

    This is the code that renders your product titles on the product page.

  3. On a new line below the line of code that includes {{ product.title }}, paste the following code:

    {% assign current_variant = product.selected_or_first_available_variant %} <span>{{ current_variant.sku }}</span>
  4. Click Save.

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 Sections directory, click product.liquid or product-template.liquid.

  2. Find the following Liquid tag:

    {{ product.title }}

    This is the code that renders your product titles on the product page.

  3. On a new line below the line of code that includes {{ product.title }}, paste the following code:

    {% assign current_variant = product.selected_or_first_available_variant %} <span>{{ current_variant.sku }}</span>
  4. Click Save.

Select your theme

The next steps for this customization vary depending on your theme. Click the button for your theme and follow the instructions.

Steps for Boundless

  1. In the Assets directory, click theme.js.liquid.

  2. Look for variant.sku.

    If you're able to find variant.sku, then you have completed the customization.

    If you're unable to find variant.sku, then continue to the next step.

  3. At the bottom of the file, paste the following code:

    document.addEventListener('DOMContentLoaded', () => {   setTimeout(function() {     const productJson = [...document.querySelectorAll('[id^=ProductJson-')];     if (productJson.length > 0) {       productJson.forEach((product) => {         const sectionId = product.id.replace("ProductJson-", "shopify-section-");         const variantSKU = document.querySelector('#' + sectionId + ' .variant-sku');         const inputSelects = [...document.querySelectorAll('#' + sectionId + ' .single-option-selector')];         const productInfo = JSON.parse(product.innerHTML);         const inputValues = [];         const optionValues = [];         let count = 0;         inputSelects.forEach((input) => {           inputValues.push(input.value);           optionValues.push(count);           input.addEventListener('change', (evt) => {             const currentValue = evt.currentTarget.value.toString();             const changedIndex = inputSelects.indexOf(evt.target);             inputValues[changedIndex] = currentValue;             variantSKU.innerText = ' ';             productInfo.variants.forEach((variant) => {               if (JSON.stringify(variant.options) == JSON.stringify(inputValues)) {                 variantSKU.innerText = variant.sku;               }             });           });           count += 1;         });       });     }   }, 100); });
  4. Click Save.

Add SKU numbers to your product variants from the admin

To have SKUs appear on your product pages, you must add SKU numbers to your product variants from in Shopify admin.

  1. From your Shopify admin, go to Products.

  2. Click on the product that you would like to edit.

  3. For products with multiple variants, in the Variants section, add your SKU numbers:

  1. For products without variants, in the Inventory section, add your SKU number:

  1. Click Save.

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


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