Shopify Metafields: How to Add Custom Fields in Shopify (The Old Way)

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ต.ค. 2024
  • Intro to Shopify Theme Development: skl.sh/2MCrJIE
    7 day free trial for new Skillshare.com users
    Wanna go deeper into Shopify Theme Development? Join my mastermind community.
    shopifythemede...
    Episode Overview
    -----------------------------
    Shopify Metafields probably seem quite inaccessible or complex at first glance but they’re actually quite handy and easy to use once you understand a few things.
    Metafields allow you to store additional information on Liquid objects which you can output to your storefront during theme development using the metafields object.
    Put in other words, Metafields are like custom fields that you can create in addition to the standard fields available on an object.
    Check out my stuff online...
    My Skillshare.com channel:
    www.skillshare...
    My travel channel:
    / christhefreelancer
    My website:
    christhefreela...
    My socials:
    Instagram: / christhefreelancer
    Facebook: / christhefreelancer
    Twitter: / chrisrdodd

ความคิดเห็น • 75

  • @CodewithChristheFreelancer
    @CodewithChristheFreelancer  3 ปีที่แล้ว +5

    Correction: %2C is the ASCII version of comma (,) not ampersand (&).
    Sorry, didn’t catch that one before publishing.
    Also, while product.images does still work, the modern version is product.media, just thought I’d mention that as well!
    Any other questions, let me know!

    • @mitchellbarnow1709
      @mitchellbarnow1709 3 ปีที่แล้ว

      Awesome video, Chris! I'm really glad to see how successful and hopefully happy that you have become!

  • @zdenekmakarov4627
    @zdenekmakarov4627 3 ปีที่แล้ว

    Thank you Chris, just what I needed 👏👏

  • @danyaalhallak4992
    @danyaalhallak4992 3 ปีที่แล้ว

    Thank you so much ! so helpful

  • @jdoogaming1575
    @jdoogaming1575 3 ปีที่แล้ว

    Great vid. This is exactly what I needed. Thank you.

  • @jefwright8460
    @jefwright8460 3 ปีที่แล้ว

    Awesome video! Super helpful. Thank you so much for the info.

  • @shopifythemesolutions.9190
    @shopifythemesolutions.9190 3 ปีที่แล้ว

    WOW WOW WOW, thank you very much :)

    • @shopifythemesolutions.9190
      @shopifythemesolutions.9190 3 ปีที่แล้ว

      Hey, what if I want to edit the metafields again from the bulk editor. When I reenter the URL, what it does, actually reset all the values to null, can you confirm?

  • @TheNewton
    @TheNewton 3 ปีที่แล้ว +1

    Note: A new feature metafield definitions is being released to stores as another method of handling mf's, see /admin/settings/metafields if it's been enabled on your store early.

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว +1

      Hi Paul. Bear with me. I will be addressing the announcements that were made recently at Shopify Unite shortly.

    • @jimjoco649
      @jimjoco649 3 ปีที่แล้ว

      that's nice to know. thanks

  • @casaceramica7102
    @casaceramica7102 2 ปีที่แล้ว

    Thanks for your great videos!
    I am considering purchasing an OS 2.0 theme, but would like to hear if it is possible with matefields, or otherwise resolve the following issue.
    I sell tiles, in whole boxes these boxes contain different amount of square meters based on size and manufacturer.
    We price set our tiles, based on square meter price, and not box price.
    It has not yet been possible for me to solve it, to such an extent that customers get the right price based on the quantity they order. Since the current set up is based on piece quantities and not square meters.
    Looking forward to hearing from you
    Best
    Adam

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 ปีที่แล้ว

      Hi Adam. I recommend you check out this video which talks about how Online Store 2.0 is not a separate system.
      th-cam.com/video/OWqqUhLdH7k/w-d-xo.html
      If you wanted to put a definition on an 'Online Store 2.0 theme', it would just be a theme with JSON templates. All of OS2.0's features now apply regardless of what theme you are using.

  • @thomasvareilhes2861
    @thomasvareilhes2861 3 ปีที่แล้ว

    Hey Chris,
    thanks a lot for this video, very instructive. What's the way to go for Customer metafields? For instance if I want to add a customer status for a loyalty program let's say "gold" "silver" or "diamond" ?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      Have you tried using the url structure I show in the video but changing the resource name to 'Customer' ?

  • @sahilmulla1680
    @sahilmulla1680 3 ปีที่แล้ว

    You can get to the bulk editor through admin > products > select a product (check box on the left) > edit

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว +1

      Ah nice! Still need to add the metafield to the url though but good to know 👍

    • @sahilmulla1680
      @sahilmulla1680 3 ปีที่แล้ว

      @@CodewithChristheFreelancer Yep! Is there a way to change the field type like a drop-down or something? More importantly can we add a field to blog pages to hide them from indexing using an if statement?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      Hey Sahil. What do you mean by 'field type'? As for hiding pages from indexing, I'm assuming you mean from an SEO perspective? As this is more of a binary thing (it either hides or it doesn't) you could just use an if statement that checks for the handle of the post.

    • @sahilmulla1680
      @sahilmulla1680 3 ปีที่แล้ว

      @@CodewithChristheFreelancer Hi! By field type I meant a drop-down or something like the availability status etc options have but that isn't mandatory. Regarding the use of handle it might be a bit cumbersome to add every handle that you want to hide. So instead I think making a metafield and checking if that contains a specific character etc would be better and we won't have to touch the code each time we add a blog or something

  • @lesellc7246
    @lesellc7246 3 ปีที่แล้ว

    Hi Chris, Great Video !!!!. Is there a way to remove metafields? Let's say I created by mistake or not needed anymore.

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว +1

      Hi Lese. Removing a metafield is as simple as clearing the contents of that field.

  • @allmamalove
    @allmamalove 2 ปีที่แล้ว

    Does this work for the Supply theme? Also what if you large inventory of products is there an easier way and for selective products?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 ปีที่แล้ว

      This is a backend thing. It works on all themes. For the second part of your question, check out the new way of doing metafields (I have a video on this also)

  • @juanbarake7387
    @juanbarake7387 2 ปีที่แล้ว

    Hey Chris, have you figured out a way to add an order metafield input box at checkout for orders?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 ปีที่แล้ว

      It's not clear what you mean by that Juan but you can add custom order properties without using metafields
      iliashaddad.medium.com/how-to-add-custom-properties-to-your-shopify-order-using-the-line-item-150c580f656e

  • @souvikmitra1607
    @souvikmitra1607 2 ปีที่แล้ว

    Hi Chris can u make a video on line item like emgraving on product page to be displayed on Dawn cart, tried diff things but not working

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 ปีที่แล้ว

      It's just cart attributes my man.
      ui-elements-generator.myshopify.com/pages/cart-attribute

  • @catboxer8257
    @catboxer8257 3 ปีที่แล้ว

    Thanks for making this video! Is there a way to add by product variant via the url?

  • @KmillionaryShopifyExperts
    @KmillionaryShopifyExperts 3 ปีที่แล้ว

    Hi Chris! Is there a way to add extra fields in the checkout page, in order to get more information from the customers? For example, here in Guatemala we need extra fields for Tribute tax number.

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว +2

      Hi Kmillionary. You can have metafields and custom order attributes on the order object. Metafields are something you only set in the admin so it would have to be order attributes.
      See here for documentation: shopify.dev/docs/themes/liquid/reference/objects/order
      It's likely however that you won't be able to do this on the checkout page as the checkout.liquid template is only editable on Shopify Plus.
      You can however take these attributes on the cart page (before the checkout page).

  • @jomotioncreative
    @jomotioncreative 2 ปีที่แล้ว

    Great video! Question: Does this method only default to text content? How would I add and manage both a multiline_text field and file (image) field with the bulk editor (the old way)? Thanks!

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 ปีที่แล้ว

      Yep. I believe all metafields (even since OS2.0) are simply stored as one line of text so you would need to code in the line breaks into the metafield value. As for the images, you'll need to upload the image somewhere and then you can use a metafield to store the path (url) to the image.

  • @WeiXin729
    @WeiXin729 2 ปีที่แล้ว

    Hi, Chris, can I ask you a question? Create collection in Shopify, can you tell me what the code is? thank you very much.

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 ปีที่แล้ว

      You can create a collection in the admin. No code required.

    • @WeiXin729
      @WeiXin729 2 ปีที่แล้ว

      @@CodewithChristheFreelancer Creating 'Product Sets' in Shopify What is the code you mentioned in this post? Can you help me?

  • @drmrboi311
    @drmrboi311 3 ปีที่แล้ว

    Hey Chris, great info. Not sure if the question was already asked. But I have thousands of products on my site. I want to add an estimated restock date to items that are back-ordered. I went to the bulk editor but I don't see a way for me to upload all the dates via a CSV file. Is there a way to do this? Otherwise, I see myself having to manually input these attributes, which can change on a daily basis.

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      Never tried it but what objects are available in the order printer templates? Is it just line_item?

  • @marcinurbanski1298
    @marcinurbanski1298 3 ปีที่แล้ว

    Hi Chris, great video. Do you know if I can filter products by them?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      Using Shopify's native filtering system: I don't think so.
      I wrote an article on filtering in Shopify here if you're interested: christopherdodd.com/shopify-collection-filtering/

    • @RachelCornishExtra
      @RachelCornishExtra 3 ปีที่แล้ว

      @@CodewithChristheFreelancer Thanks for such a quick reply and for the link. I have build the filters myself using tags but struggling with filtering by price. I know I can create tags ($10 - $20) and filter by them but I would like to use range slider from min price to max price. Do you know any tips and trick that can help with this?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      That will be a bit tricky but I believe it would be possible. Think you would have to define each possible range as it's own tag.

  • @manuelasabatino6782
    @manuelasabatino6782 2 ปีที่แล้ว

    Hi, very interesting your tutorial. Do you know if I can create a plugin where I create a metafield for a checkout page and I add a javascript component to this metafield? The component would make some API calls to get autosuggested address words.

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 ปีที่แล้ว

      Not sure if you can use metafields in the checkout (especially if not on Shopify Plus) but by 'plugin' I suspect you are referring to an 'app'. Shopify recently announced 'checkout apps' which are able to interact with your checkout. I'd suggest looking into that.
      Examples on the app store:
      apps.shopify.com/collections/checkout

  • @dvaldesr
    @dvaldesr 3 ปีที่แล้ว

    any chance to show the metafields in the packinglist using order printer app?

  • @tonytullemans613
    @tonytullemans613 2 ปีที่แล้ว

    This has completely changed in the latest version of Shopify.

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 ปีที่แล้ว

      Hence why 'The Old Way" is written in the title. Check out my newer video on the subject.

  • @flaviomauri
    @flaviomauri 3 ปีที่แล้ว

    Mmh if there's a page like that, for which we have to write the address manually...wouldn't it be possible to create a simple tool to redirect us to that page? ie: a form on even a local webpage where one would fill in as many metafields as necessary, hit submit, and get directed there?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว +1

      If you're talking about a regular user (customer) of the website then no as you need to be an admin to access that page. If you are talking about admins, then yeah, for sure that's possible.

    • @flaviomauri
      @flaviomauri 3 ปีที่แล้ว

      @@CodewithChristheFreelancer Thanks! I failed to mention I was thinking of a tool to make life easier for developers ;)

  • @luckysales8558
    @luckysales8558 3 ปีที่แล้ว

    Hi Chris, is it possible for customers to upload a picture at the checkout page?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      There is an option to add a file input to your add to cart form.
      See here: th-cam.com/video/SGtD6Pka9U0/w-d-xo.html

  • @gen_ninety97
    @gen_ninety97 3 ปีที่แล้ว

    Can we add stripe payment to our shopify?

  • @lesellc7246
    @lesellc7246 3 ปีที่แล้ว

    HI, How would I go about displaying the content of the metafields on Order confirmation email and packing list?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      Never tried it but I found this article via a quick Google search: community.shopify.com/c/Shopify-APIs-SDKs/Insert-metafields-in-order-email-notifications/td-p/148358

  • @muscularavocado3547
    @muscularavocado3547 3 ปีที่แล้ว

    Did I just miss it? Is there a way afterwards to add the metafield into the admin editor interface?
    I am looking to have a option to remove ingredients, but the names of the ingredients will depend on the product. Im looking for the option to change ingredients in the admin. Is this possible?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      Hi Bailey. You can use the same editor to update the contents of the metafield whenever you like. (I start typing the url at 5:06)

    • @muscularavocado3547
      @muscularavocado3547 3 ปีที่แล้ว

      @@CodewithChristheFreelancer Thanks Chris! Here's what I was able to do:
      I gave each Milkshake a "Removeable Items" metafield and for the value put it in as a string "Item 1, item 2, item 3" (each milkshake has a different amount of removable items)
      On the product page, I parsed the items by commas, and created a button for each item. So now I have buttons to remove each item! :)
      Thanks so much!

  • @mattm501
    @mattm501 3 ปีที่แล้ว

    Is there a way to set this up to work with Blogs ??

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      The documentation says that Metafields are available on blogs but perhaps not on blog posts. I'd replace 'Product' in the url with 'Article' and see what happens.

  • @misskevine5503
    @misskevine5503 3 ปีที่แล้ว

    I literally tried this 11 times, and it's saying page not found! Am I the only one?? I don't understand what I am doing wrong

  • @HARPREETKAUR-fn9dx
    @HARPREETKAUR-fn9dx 3 ปีที่แล้ว

    Hi, I am creating a website for doctors where customer can book appointment and make payment. Please suggest an app in shopify to do so...

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  3 ปีที่แล้ว

      Hi Harpreet. I would probably use a third-party solution for that, wouldn't need to be Shopify specific.

    • @RajeshGupta-os5cy
      @RajeshGupta-os5cy 3 ปีที่แล้ว

      I think you should go with WordPress CMS