What's your biggest current challenge? Have your say in Community Polls along the right column.

Shopify Index Page Error ( Not Found ) when update value layout/theme.liquid

Shopify Index Page Error ( Not Found ) when update value layout/theme.liquid

santonikho
Shopify Partner
1 0 0

Hi Shopify App Store developer,

 

can help to check what why facing error during update value into key "layout/theme.liquid" ?

error code return :

Shopify Index Page Error : {"errors":"Not Found","error_reference":"If you report this error, please include this id: 21770abd-c6a1-442e-833a-f32e5536ddcb-1715762926."}

 

here is code request :

 

theme = ShopifyAPI::Theme.all&.find { |t| t.role == "main" }
if theme&.id.present?
asset = ShopifyAPI::Asset.all(theme_id: theme.id, asset: {"key" => "layout/theme.liquid"})&.first
if asset&.value.present?
test_session = ShopifyAPI::Context.active_session
update_asset = ShopifyAPI::Asset.new(session: test_session)
update_asset.theme_id = theme.id
update_asset.key = "layout/theme.liquid"
update_asset.value = asset.value.sub("<head>", "
<head>
<!-- Google Tag Manager (noscript) Your GTM code or any other modifications  -->
")
update_asset.save!
end
end


Replies 0 (0)