Liquid Snippets by ALSEL
📘 公式リファレンス📦 リファレンス/オブジェクト中級

location オブジェクト

ストアの実店舗(ロケーション)を表すオブジェクト。ID、名前、住所、座標、メタフィールドなどの店舗情報を保持する。

用途
商品ページで店舗受取対応の配送方法を表示するとき、各ロケーションの名前や住所、地図表示用の緯度経度を参照して顧客に選択肢を提示する。
設置場所
Liquid テンプレート内で `{{ product.selected_variant.store_availabilities[0].location.name }}` のように、store_availability オブジェクトの location プロパティを経由して参照する。
注意点
location オブジェクトはストアの少なくとも1つのロケーションで店舗受取が有効になっている場合のみ定義される。緯度・経度(latitude / longitude)はロケーションの住所が管理画面で検証済みの場合のみ返され、未検証だと nil になるため、地図表示時は nil チェックを入れる。メタフィールドは別途 Shopify 管理画面で作成・割り当てが必要。
タグ:locationstore-pickupaddressstore-availabilitymetafield

仕様

122 行 / json
{
  "access": {
    "global": false,
    "parents": [
      {
        "object": "store_availability",
        "property": "location"
      }
    ],
    "template": []
  },
  "deprecated": false,
  "deprecation_reason": "",
  "description": "> Tip:\n> The `location` object is defined only if one or more locations has [local pickup](https://help.shopify.com/manual/shipping/setting-up-and-managing-your-shipping/local-methods/local-pickup)\n> enabled.",
  "properties": [
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "number",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The location's ID.",
      "name": "id"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "string",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The location's name.",
      "name": "name"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "address",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The location's address.",
      "name": "address"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "If the location's address isn't verified, then `nil` is returned.",
      "examples": [],
      "return_type": [
        {
          "type": "number",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The latitude of the location's address.",
      "name": "latitude"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "If the location's address isn't verified, then `nil` is returned.",
      "examples": [],
      "return_type": [
        {
          "type": "number",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The longitude of the location's address.",
      "name": "longitude"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "> Tip:\n> To learn about how to create metafields, refer to [Create and manage metafields](/apps/metafields/manage) or visit\n> the [Shopify Help Center](https://help.shopify.com/manual/metafields).",
      "examples": [],
      "return_type": [
        {
          "type": "untyped",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The [metafields](/docs/api/liquid/objects/metafield) applied to the location.",
      "name": "metafields"
    }
  ],
  "summary": "A store [location](https://help.shopify.com/manual/locations).",
  "name": "location",
  "examples": [],
  "json_data": {
    "path": "/products/health-potion?variant=39897499729985",
    "handle": "product.selected_variant.store_availabilities[0].location",
    "data_from_file": ""
  },
  "return_type": []
}

出典・ライセンス

License:
MIT

このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。

関連項目

📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_header オブジェクト

Shopify が必要とするスクリプト(分析・チェックアウト・言語設定など)をすべて動的に出力するオブジェクト。theme.liquid の <head> タグ内に埋め込む必須要素。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト中級

metaobjects オブジェクト

ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト初級

additional_checkout_buttons オブジェクト

PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

canonical_url オブジェクト

現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_index オブジェクト

ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_additional_checkout_buttons オブジェクト

PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。

📁 theme-liquid-docs·MIT·27