Solved

Adding metafield values through code

kurs
Shopify Partner
4 0 1

Can I add data to customer metafiled. It's type is 'products' (list of products). I would like to create a button for every product, that adds them to wishlist page and also to customer metadata.

Accepted Solution (1)
Ishan_Makkar
Shopify Expert
115 7 8

This is an accepted solution.

We need to add an app for the wishlist so that we can use it on every page of the website and for a particular product we can use a meta field.

Shopify Expert Since 2012
Sr. Web Solution Manager at MakkPress Technologies
Website Speedy (SAAS tool for Shopify Speed Optimization - Trusted by over 300 Shopify store owners)
Contact Us or Hire Us Or Email Us

View solution in original post

Replies 3 (3)

Ishan_Makkar
Shopify Expert
115 7 8

Hello @kurs , Welcome to the Shopify Community!

Yes, you can add data to customer metafields in Shopify. To create a wishlist functionality that also updates customer metafields with product data:

  1. Create a metafield for customers to store the list of products.
  2. Implement a button on product pages to add products to the wishlist and update customer metafields.
  3. Use Shopify's APIs and JavaScript for backend logic and frontend interaction.

If you need more assistance, provide further details.

Shopify Expert Since 2012
Sr. Web Solution Manager at MakkPress Technologies
Website Speedy (SAAS tool for Shopify Speed Optimization - Trusted by over 300 Shopify store owners)
Contact Us or Hire Us Or Email Us
kurs
Shopify Partner
4 0 1

Thank you for answear. How can I use javascript and apis for adding values to customer metafields? Right now I have simple javascript code incorporated in theme code, that saves products to localstorage. Every product and product card has like button, that updates wishlist and wishlist page. I've also created metafield for customers to store liked products (type: list of products).

Ishan_Makkar
Shopify Expert
115 7 8

This is an accepted solution.

We need to add an app for the wishlist so that we can use it on every page of the website and for a particular product we can use a meta field.

Shopify Expert Since 2012
Sr. Web Solution Manager at MakkPress Technologies
Website Speedy (SAAS tool for Shopify Speed Optimization - Trusted by over 300 Shopify store owners)
Contact Us or Hire Us Or Email Us