Debug: Checking metaobject - mbucket=, mcountry=, mregion=
%- if mbucket == bucket_key and mcountry == country_l and mregion == "" -% %- if map.collection.value != blank -% %- assign country_href = map.collection.value.url -% %- assign country_matched = true -%Debug: Country match found - country_href=/collections/shop-all?filter.p.m.custom.country=Scotland
%- endif -% %- break -% %- comment -% Found a country match, stop looking for country -% endcomment -% %- endif -% %- endfor -% %- if country_matched == false -% %- capture country_href -% /collections/shop-all?filter.p.m.custom.country=Scotland %- endcapture -% %- endif -% %- comment -% Now, find a region match to set region_href -% endcomment -% %- for map in shop.metaobjects.attribute_link_map.values -% %- assign mbucket = map.bucket.value | downcase | strip -% %- assign mcountry = map.country.value | downcase | strip -% %- assign mregion = map.region.value | downcase | strip -% %- if mbucket == bucket_key and mcountry == country_l and mregion == region_l -% %- if map.collection.value != blank -% %- assign region_href = map.collection.value.url -% %- endif -% %- break -% %- comment -% Found a region match, stop looking -% endcomment -% %- endif -% %- endfor -% %- comment -% Debug output to verify values -% endcomment -%Debug: product_type=, pt_handle=, bucket_key=spirits
Debug: country_l=scotland, region_l=
Debug: final country_href=/collections/shop-all?filter.p.m.custom.country=Scotland , final region_href=/collections/shop-all?filter.p.m.custom.region=
%- for map in shop.metaobjects.attribute_link_map.values -%Metaobject: bucket=, country=, region=blank, collection=
%- endfor -%- BrandHighland Park
- CountryScotland
- Size750ml