Metafields can be added to products, variants, collections, etc.
We add a simple bookmark to our browser that contains some javascript, called a bookmarklet. When the bookmarklet gets clicked it modifies the url and reloads the browser with it.
- Create a new bookmark in your browser
- Enter a descriptive name of your liking
- Copy/paste the javascript from below into the location/url field of the bookmark
Bookmarklet to manually enter metafields names:
javascript: function reload () { const href = document.location.href; const regex = /(admin\/bulk\?resource_name=\w+&edit=)(.+?)&(.*)/; if (!regex.test(href)) { alert('This is not a bulk edit page'); return; } let fieldnames = prompt('Metafield name ( separate multiple by comma)', 'unpublished_at'); const metafields = fieldnames.split(',').map((name) => { return 'metafields.global.'+name.trim()+'%3Astring'; }).join('%2C'); document.location = href.replace(regex, '$1'+metafields+'$3'); }; reload();
Bookmarklet for single ('unpublished_at') metafield:
javascript: function reload () { const fieldname = 'unpublished_at'; const href = document.location.href; const regex = /(admin\/bulk\?resource_name=\w+&edit=)(.+?)&(.*)/; if (!regex.test(href)) { alert('This is not a bulk edit page'); return; } document.location = href.replace(regex, '$1metafields.global.'+fieldname+'%3Astring$3'); }; reload();
For products:
- open products list in Shopify admin
- select one or more products from list by checkbox
- click "edit products" action button
- click bookmarklet from within your browser
- this bookmarklet will ask your for the metafield name you want to edit
- the shopify page reloads with the chosen metafields to edit
For variants:
- select a single product to edit in Shopify admin
- under variants, check the "select all" checkbox
- click "open bulk editor" action button
- continue as above