What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How To Add Render Tag In Theme.Liquid File Using 3rd Party App

How To Add Render Tag In Theme.Liquid File Using 3rd Party App

priyankatotalav
Shopify Partner
7 0 1

I am trying to modify the theme.liquid file using my app.

When I try to modify the theme.liquid file using this endpoint,

 

$response = $this->shopify_lib->call('PUT', '/admin/themes/' . $theme_id . '/assets.json', array('asset' => array('key' => 'layout/theme.liquid', 'src' => site_url('../assets/geo/' . $this->session->userdata('shop') . '/theme.liquid'))));

 

 

In the above lines, I am trying to add my logic code to Shopify's theme.liquid from the file which is in present in my server.  

But I get this below error. This error is happening only with the themes built based on DAWN. Previous theme structure allows me to modify the theme.liquid file (which gave the success response for this PUT endpoint.)

I could not find any articles or discussions based on this.

 

Array
(
    [error_data] => Array
        (
            [method] => PUT
            [path] => /admin/themes/120457298053/assets.json
            [error_type] => API
            [params] => Array
                (
                    [asset] => Array
                        (
                            [key] => layout/theme.liquid
                            [src] => https://xxxxx/xxxxx/xxxx.php/../xxxxxxx/theme.liquid
                        )

                )

            [response_headers] => Array
                (
                    [http_status_message] => Unprocessable Entity
                    [http_status_code] => 422
                    [date] => Wed, 04 May 2022 04:41:44 GMT
                    [content-type] => application/json; charset=utf-8
                    [transfer-encoding] => chunked
                    [connection] => keep-alive
                    [x-sorting-hat-podid] => 132
                    [x-sorting-hat-shopid] => 33053081733
                    [referrer-policy] => origin-when-cross-origin
                    [x-frame-options] => DENY
                    [x-shopid] => 33053081733
                    [x-shardid] => 132
                    [x-stats-userid] => 
                    [x-stats-apiclientid] => 6528661
                    [x-stats-apipermissionid] => 324511105157
                    [http_x_shopify_shop_api_call_limit] => 3/40
                    [x-shopify-shop-api-call-limit] => 3/40
                    [x-shopify-api-version] => 2021-07
                    [strict-transport-security] => max-age=7889238
                    [x-shopify-stage] => production
                    [content-security-policy] => default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=update&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fassets&source%5Bsection%5D=admin_api&source%5Buuid%5D=fc0048c5-dd46-4a0b-8275-149578ceb276
                    [x-content-type-options] => nosniff
                    [x-download-options] => noopen
                    [x-permitted-cross-domain-policies] => none
                    [x-xss-protection] => 1; mode=block; report=/xss-report?source%5Baction%5D=update&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fassets&source%5Bsection%5D=admin_api&source%5Buuid%5D=fc0048c5-dd46-4a0b-8275-149578ceb276
                    [x-dc] => gcp-us-east1,gcp-us-central1,gcp-us-central1
                    [x-request-id] => fc0048c5-dd46-4a0b-8275-149578ceb276
                    [cf-cache-status] => DYNAMIC
                    [expect-ct] => max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
                    [server] => cloudflare
                    [cf-ray] => 705e90c7085959fd-IAD
                    [alt-svc] => h3=":443"; ma=86400, h3-29=":443"; ma=86400
                )

            [response] => Array
                (
                    [errors] => Array
                        (
                            [asset] => Array
                                (
                                    [0] => The file does not exist - https://xxxxx/xxx/xxxx.php/../xxxxxxxxx.myshopify.com/theme.liquid
                                )

                        )

                )

        )

    [status_response] => error
)
Replies 0 (0)