【问题标题】:How we can automatically inject liquid code inside shop's theme using shopify app?我们如何使用 shopify 应用程序在商店主题内自动注入液体代码?
【发布时间】:2016-05-14 14:13:43
【问题描述】:

我正在构建一个 Shopify 应用程序,我有兴趣自动将流动内容添加到商店的主题中。

【问题讨论】:

  • 您的意思是在页面渲染时更新主题或动态注入液体代码?是的。两者在某种程度上都是可能的。这不是本论坛的问题类型。

标签: ruby-on-rails shopify liquid


【解决方案1】:

这是我用来在活动主题中插入液体文件的代码。

    $asset = $shopify('PUT /admin/themes/' . $id . '/assets.json', array(), array
    (
        'asset' => array
        (
            "key" => "snippets/file.liquid",
            "src" => "https://yourdomain.com/file.liquid"
        )
    ));

获取我使用的活动主题 ID

            foreach ( $themes as $theme){
                if($theme[role] == 'main'){
                    $id = $theme[id];
                }
            }

如果这有帮助,请告诉我。

【讨论】:

    猜你喜欢
    • 2012-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-05
    • 1970-01-01
    • 1970-01-01
    • 2021-03-13
    • 1970-01-01
    相关资源
    最近更新 更多