Shopify Metafields - How to use them in Shopify Liquid code

Поделиться
HTML-код
  • Опубликовано: 25 авг 2024
  • Wanna go deeper into Shopify Theme Development? Join my mastermind community.
    shopifythemede...
    Or sign up for a free trial with Skillshare and take my Shopify class for free:
    skl.sh/2MCrJIE
    Do you run a business on Shopify and want help with your store? Get in contact
    form.typeform....
    Episode Overview
    -----------------------------
    The metafields system in Shopify is something that has been continually evolving since Online Store 2.0 in 2021.
    While all the changes might sound kinda simple, it’s further complicated how we use metafields in Shopify Liquid. So in this video, let’s take a refreshed look at how to use metafields within Shopify Liquid code.
    My Other Videos Mentioned
    ---------------------------------------------
    My first video on Metafields
    • Shopify Metafields: Ho...
    Metafields since Online Store 2.0
    • Shopify Metafields: Ho...
    Shopify Editions Summer 2023 Recap
    • Shopify Editions - Wha...
    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

Комментарии • 54

  • @ginacostanzo4005
    @ginacostanzo4005 Год назад +4

    I have literally spent the entire day trying to figure out how to access metaobject data referenced in a metafield... THANK YOU!!!

    • @KnivesandStones
      @KnivesandStones 6 месяцев назад

      I spent two days before finally stumbling this video, great work!

  • @hortology
    @hortology 5 месяцев назад +1

    Thanks for demystifying this, you have just opened up a world of possibilities for using metaobjects, much appreciated

  • @oscarcrisanto3072
    @oscarcrisanto3072 Месяц назад

    This has change from the time the video was uploaded to now July 2024 in order to access an image via metafields, you now have to add image_url separated by "|" and then add image_tag the img has been dropped in recent updates to shopify 2.0

  • @christophernelson2261
    @christophernelson2261 23 дня назад

    Chris thank you! It feels rewarding combing through all the dropshipping crap to finally get some dev advice on how to implement these solutions.

  • @ProjectorPeople
    @ProjectorPeople 3 месяца назад

    Excellent tutorial. Perfectly explained.

  • @kovid.rathee
    @kovid.rathee 6 месяцев назад +1

    Great tutorial!

  • @RyanLeeLab
    @RyanLeeLab 9 месяцев назад

    Hi I subscribed today. Thank you for all valuable information for Shopify users.

  • @diegotaylor8547
    @diegotaylor8547 Год назад

    Hi Chris, I found that you got a new RUclips avatar, cool! Glad you're back! In fact, maybe 1 or 2 days ago, I was thinking about posting a comment in any of your RUclips videos to make sure you're fine. It has been 3 months since your last update! I suggest update at least once each month :)

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  Год назад

      I've been a bit busy sorry! Two more videos are in the works and should be out soon though ;)

  • @dimavavilov7737
    @dimavavilov7737 10 месяцев назад

    Thank you so much! You helped me with my problem

  • @eloctinar
    @eloctinar 5 месяцев назад

    good stuff, thanks!

  • @user-mn9xz8tl7b
    @user-mn9xz8tl7b 11 месяцев назад

    thanks buddy

  • @tet726
    @tet726 Год назад

    I really appreciated this video. In Japan, to use Shopify is in the minority so there's no one who I can ask for help.

  • @rayediaz
    @rayediaz Год назад

    Very helpful!

  • @supportmyappsmarket2576
    @supportmyappsmarket2576 Год назад +2

    I am the first person who like & comment the video

  • @JayZambrano
    @JayZambrano Год назад +1

    Hey Chris. Thanks for sharing, pretty userful! I'd like to have the ability to create repeatable groups of metafields. Do you know if Shopify is making this possible?

  • @PuffyCloud-qq6gn
    @PuffyCloud-qq6gn 2 месяца назад

    Hi, thank you for that. I am trying to add a metafield into a liquid code, but I could not grasp in the end which piece of code in your file I’d have to add to this liquid code? I basically have a weather widget on a page template on which Id like to replace the coordinates with a metafield, the location is set up as a simple line text field. I have set up your page template, and added the metafield, it shows this particular location, but then how do I add this to the Shopify Liquid code section? There is the widget code. Do I just replace the location coordinates in the widget code, with the metafield name? I am probably wrong, but I sort of missed the link to the shopify liquid code section there. Thank you!

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  2 месяца назад

      How did you build the widget? Or is it generated via an app you have installed on your store?

  • @albi55uk
    @albi55uk 5 месяцев назад

    Your only aloud 20 Metafields, is there a way to add more?

  • @user-mb9zi6fi1o
    @user-mb9zi6fi1o 11 месяцев назад

    how to add metafields into homepage?

  • @freeskierjim
    @freeskierjim 10 месяцев назад

    Chris, thanks for the informative video. Is there a way to match search keyword / search query to shopify product title? In other words, make the shopify product title dynamic?

  • @giacomobaggio7313
    @giacomobaggio7313 6 месяцев назад

    Hi there, nice video!
    Do you know if it possible to access the definition from a metafield object in Liquid? I have to work with the validations of the metafield definitions but I'm not able to get them

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  6 месяцев назад

      The only access you have to the field is through the metafield object. Why do you need to read the validations for specific metafields?

  • @vishvajitkumar9497
    @vishvajitkumar9497 9 месяцев назад

    Hi chris nice video. can u explain how do i insert value in metafields from liquid file??

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  8 месяцев назад

      You mean you would like to give a user the ability to edit a metafield value on the frontend?

    • @vishvajitkumar9497
      @vishvajitkumar9497 8 месяцев назад

      @@CodewithChristheFreelancer yes

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  8 месяцев назад

      That won't be possible without creating some kind of API that then connects to Shopify and inserts the data via the admin API. You can't do it with it Liquid.

  • @xyzxyz324
    @xyzxyz324 9 месяцев назад

    I tried to create a metafield for choosing some of the collections from my entire collections. I managed to choose them but when i go to the custom page, when i connect as dynamic resource, to show them in a collection list, its giving error that no references are selected. What may be the cause ? How many definitions should i create in a metatag

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  9 месяцев назад

      "giving error that no references are selected" - what do you mean by this? Is the error in your console? What does it say exactly?

  • @danieledepaolis5259
    @danieledepaolis5259 Год назад

    Hey Chris, thanks for the informative video. I have a question on metafields for products: I have 1 SKU with different prices. Below the original price it lets me decide if I want to charge the tax on top of the price, by simply checking the box. But it doesn't let me to do the same for the each of the prices that I set up with metafields. The problem is that I don't want to charge tax on the original price, but I do want to charge the tax on the metafield price. How can I solve this? Thanks in advance!

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  Год назад

      Hey Daniel. This is a bit of a unique case. If you send me a message on Patreon I can take a look for you.
      www.patreon.com/shopifydeveloper

  • @adamstorey8251
    @adamstorey8251 9 месяцев назад

    Will this help or is there a way to code in more metafields ? thank you,

  • @thebizyman1
    @thebizyman1 Год назад

    Hi Chris, really enjoy your videos. Can a customer metafield be exposed for an integration with say Jotform? I'm collecting a field in Jotform that does not existing in shopify but want to populate it to a metafield. Is that possible by creating a customers.metafield?

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  11 месяцев назад

      You can expose it but only via the Admin API I believe. That's why you need an app in order to receive any data from a user (beyond the normal user input),.

  • @elitheasian
    @elitheasian Год назад

    Hi Chris, metafields and metaobjects are without a doubt very useful! But when you have a store with hundreds of unique products, how do you automatically add metafields to products via csv imports or rules? I’m having trouble finding a solution that does not require an external app…

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  Год назад

      Unless the option exists in the Shopify admin, the only alternative is to use (or build) an app.

  • @merihdecember4058
    @merihdecember4058 7 месяцев назад

    Hey Chris, thank you for these great tutorials. We are using a vintage shopify theme and trying to upgrade it to version 2.0 The confusing part is the "create template" feature. If we cannot create a template in the vintage version (which is the live version), how can we make it visible in the preview theme (new version is not published yet)? Would creating a new template in the templates section in the backend of the vintage theme work?

    • @ChristheFreelancer
      @ChristheFreelancer 7 месяцев назад

      Why can't you create a template?

    • @merihdecember4058
      @merihdecember4058 7 месяцев назад

      You can only create a metaobject template but not a template from the dropdown menu in the 3.4.0. version it seems. So I created a template manually in the backend and it shows up in the drop down menu in the live version. But it doesn't show up in the preview theme which is version 11. I'm also on skillshare following your classes, so if I'm missing something you can refer to a video there as well!

    • @ChristheFreelancer
      @ChristheFreelancer 7 месяцев назад

      @@merihdecember4058 did you also create the template (manually) on the preview version?

    • @merihdecember4058
      @merihdecember4058 7 месяцев назад

      @@ChristheFreelancer Yes I did. The old version of the theme has the default collection template in liquid and the new version has it in json. When I create the same file in both versions either it can't pull the collection data, showing nothing but only the header and footer or a pile of code. I've been trying to re-create the json file in the old version and also added all the sections the json code is referring to but no luck :(

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  7 месяцев назад

      Looks like my reply didn't come through so I'll write it again. If you send me a video explaining the issue to my email chris@christhefreelancer.com, I'll take a look asap as what you're describing should not be happening.

  • @ApoorvDwivedi
    @ApoorvDwivedi Год назад

    Hi Chris, just out of the box question, is there a way by which i can edit the value of cart.total_price in cart.liquid so that checkout happens on the price i want to send

    • @CodewithChristheFreelancer
      @CodewithChristheFreelancer  Год назад

      haha no. You can use Shopify Liquid to modify data. You can of course change it's output by passing the original value through one or more filters but you cannot mutate the data via Liquid.

    • @ApoorvDwivedi
      @ApoorvDwivedi Год назад

      @@CodewithChristheFreelancer can u please make a video for that. I need to implement a code with conditions to give discounts if line item has more than 5 or 10 quantity in it.

  • @Salamaleikum80
    @Salamaleikum80 Год назад

    My Custom Data is named athlete, but for me the code doesn't say "page.metafields.custom.athlete" instead it only says athletes.first_name to access the first name field. But that doesn't work when I write {{athletes.first_name}} am I missing something?