Checkout Extension Metafield array is empty

Checkout Extension Metafield array is empty

Schmidtc63
Shopify Partner
98 14 27

This is  a JavaScript (not React) extension:

 

export default extension(
	"purchase.checkout.shipping-option-list.render-after",
	async (root, {lines, applyCartLinesChange, query, i18n, shippingAddress, shop, buyerJourney, buyerIdentity, storage, settings, ui, metafields}) => {
    console.log(metafields.current); // the array is empty
.
.
.
});

 

 

my .toml file includes the following:

 

[[extensions.metafields]]
namespace = "kickee"
key = "notforwholesale"
[[extensions.metafields]]
namespace = "kickee"
key = "nfs"

 

I only have one target in my .toml so that's not the issue.

 

I have a product with both those metafields and the metafields are defined:

Schmidtc63_0-1711641825829.png

Schmidtc63_2-1711641941275.png

What am I doing wrong?

 

thank you,

Chris

 

 



 

 

 

Reply 1 (1)

Schmidtc63
Shopify Partner
98 14 27

This also does not work:

 

metafields.subscribe((newMetafields) => {
  currentMetafields = newMetafields;
  console.log(`metafields: `, currentMetafields, newMetafields); // blank arrays
});