What's your biggest current challenge? Have your say in Community Polls along the right column.

How to update metafield through ajax call

How to update metafield through ajax call

Khasim1
Shopify Partner
30 0 0

Hi

 

I am trying to implement wishlist functionality through customer metafields. Can anyone help me on how to update the customer metafield when a product is added to or removed from wishlist in liquid store through ajax call. 

 

I implemented in a different way earlier where product data is stored in local storage but the drawback here is it doesnt store data for the registered uers when they log out and then log in. So to save logged in users wishlist I need help on updating metafields with product data.

 

Thanks

Khasim

Replies 2 (2)

BSSCommerce-B2B
Shopify Partner
1969 564 566

There is no way to update metafields through ajax API but admin apis because it requires write_products scopes 

You could create a custom app in Admin, and check Admin API integration scopes: write_products and read_products to manage product metafields.

BSSCommerceB2B_0-1718853468940.png

 

Then, you could use the given access token to make a Shopify API call to update product metafields. But, access token is too dangerous to be exposed to the storefront, you should hide the real logic behind the app proxy. In general, you must develop a simple server for that 😫

BSSCommerceB2B_1-1718853534641.png

 

 

B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.


B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.


B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.


BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now

Khasim1
Shopify Partner
30 0 0

If possible can you provide any reference which I can follow to implement this?