Shopify: how to retrieve shop level metafield in the cartpage?

Viewed 17

At a shop level, I created a metafield for disabled dates as shown in the image below, that I want to retrieve and assign to a LIQUID variable in the code following the image.

enter image description here

Code in cart page:

window.addEventListener("load", function() { 
  // Don't add 0 before month and date to make it two digit.
  //var disabledDays = ["2022-5-30","2022-7-4","2022-9-5","2022-11-24","2022-12-23","2022-12-24","2022-12-25","2022-12-30","2022-12-31","2023-1-1","2023-1-2"];
  disabledDays = {{ shop.metafields.disabledDays.value }};
  var minDate = new Date();
  var maxDate = new Date();
  maxDate.setDate((maxDate.getDate()) + 60);
  minDaysToShip = 2;        // Default minimum days
  if (minDate.getDay() == 5) {
    // Friday. Set min day to Tuesday. 4 days from now.
    minDaysToShip = 4;
  } else if (minDate.getDay() == 6) {

I see that {{ shop.metafields.disabledDates.value }}; is not reading the metadata content. Please show me the right way to do it.

1 Answers
Related