LoginSignup
3
3

More than 3 years have passed since last update.

[Shopify] API 更新 12/02/2019

Last updated at Posted at 2019-12-03

Shopify API更新 12/02/2019
https://developers.shopify.com/changelog/new-liquid-global-object-and-property

Liquid global object and propertyが追加されたようです、すでにすべてのショップに反映済みとのことです。

request.page_type

リクエストしたページタイプが返ってきます。

下記一覧

  • 404
  • article
  • blog
  • cart
  • collection
  • list-collections
  • customers/account
  • customers/activate_account
  • customers/addresses
  • customers/login
  • customers/order
  • customers/register
  • customers/reset_password
  • gift_card
  • index
  • page
  • password
  • product
  • search

詳細はこちらを参照ください
https://help.shopify.com/en/themes/liquid/objects/request#request-page_type

routes

各ページで設定しているURLが取得できます。

  • routes.root_url
  • routes.account_url
  • routes.account_login_url
  • routes.account_logout_url
  • routes.account_recover_url
  • routes.account_register_url
  • routes.account_addresses_url
  • routes.collections_url
  • routes.all_products_collection_url
  • routes.search_url
  • routes.cart_url
  • routes.cart_add_url
  • routes.cart_change_url
  • routes.cart_clear_url

詳細はこちらを参照ください
https://help.shopify.com/en/themes/liquid/objects/routes

product.options_by_name

商品のオプション名で直接アクセスすることができます。

Liquid

<label>
  Color
  <select>
    {% for color_option in product.options_by_name['Color'].values %}
      <option>{{ color_option }}</option>
    {% endfor %}
  </select>
</label>

Html(アウトプット)

<label>
  Color
  <select>
    <option>Red</option>
    <option>Green</option>
  </select>
</label>

詳細はこちらを参照
https://help.shopify.com/en/themes/liquid/objects/product#product-options_by_name

allow_false

null or empty の値に対してfalseをセットすることができます。

{{ settings.flag | default: true, allow_false: true }}
<!-- If settings.flag is false -->
false
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3