Themes/Assets API PUT - settings_data.json not updated or creatable

Solved
breakworm
Tourist
5 2 0

Hi,

I am writing a Shopify app integration feature which intends to duplicate the 'main' published theme for a Shopify store and then based on the main previous theme, make add small adjusts to templates files for a client to preview .

I have tried the following methods to create a new theme file and managed to copy all files expect for config/settings_data.json successfully which seems to be changing when added to a newly created themes code.


Method 1) Create new theme via zip file:

POST /admin/api/2020-10/themes.json
{
  "theme": {
    "name": "debut[new-install]",
    "src": "http://themes.shopify.com/mytheme.zip",
    "role": "unpublished"
  }
} 

config/settings_data.json content in newly created theme  :

{
}

 

Method 2) Create new empty theme

POST /admin/api/2020-10/themes.json
{
  "theme": {
    "name": "debut[new-install]""role": "unpublished"
  }
}

 Then copy all assets from current active themes assets list them via:

GET /admin/api/2020-10/themes/828155753/assets.json?asset[key]=templates/index.liquid

 Then PUT each asset from current theme into the new unpublished theme via :

PUT /admin/api/2020-10/themes/828155753/assets.json
{
  "asset": {
    "key": "config/settings_data.liquid",
    "value": "<<content of original file>>"
  }
}

Same results for method 3 shown at bottom of post.

 

Method 3) Use method 2 as above however specifically upload settings_data.json file as settings_data_new.json, then use asset endpoint duplication as below:

PUT /admin/api/2020-10/themes/828155753/assets.json
{
  "asset": {
    "key": "config/settings_data.liquid",
    "source_key": "config/settings_data_new.liquid"
  }
}


I check and can confirm that the file settings_data_new.json is an identical match to the main original theme file before making a copy.

After duplicating settings_data_new.json into a new settings_data.json file within the newly created theme, this results are incorrect settings_data.json file and missing various segments from the original file.

settings_data.json - result from method 2 & 3

{
  "current": {
    "checkout_header_image": "",
    "checkout_logo_image": "shopify:\/\/shop_images\/converse_logo.png",
    "checkout_logo_position": "left",
    "checkout_logo_size": "small",
    "checkout_body_background_image": "",
    "checkout_body_background_color": "#fff",
    "checkout_input_background_color_mode": "white",
    "checkout_sidebar_background_image": "",
    "checkout_sidebar_background_color": "#fafafa",
    "checkout_heading_font": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",
    "checkout_body_font": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",
    "checkout_accent_color": "#197bbd",
    "checkout_button_color": "#197bbd",
    "checkout_error_color": "#e32c2b",
    "color_text": "#3d4246",
    "color_body_text": "#788188",
    "color_sale_text": "#7796a8",
    "color_borders": "#e8e9eb",
    "color_button": "#7796a8",
    "color_button_text": "#fff",
    "color_small_button": "#fff",
    "color_small_button_text": "#3d4246",
    "color_text_field": "#fff",
    "color_text_field_text": "#000",
    "color_image_overlay_text": "#fff",
    "color_image_overlay": "#3d4246",
    "image_overlay_opacity": "0.25",
    "color_body_bg": "#fff",
    "type_header_family": "Google_Work+Sans_600_sans",
    "type_header_base_size": "26px",
    "type_base_family": "Google_Work+Sans_400_sans",
    "type_base_size": "16px",
    "type_bold_product_titles": false,
    "share_facebook": true,
    "share_twitter": true,
    "share_pinterest": true,
    "social_twitter_link": "",
    "social_facebook_link": "",
    "social_pinterest_link": "",
    "social_instagram_link": "",
    "social_tumblr_link": "",
    "social_snapchat_link": "",
    "social_youtube_link": "",
    "social_vimeo_link": "",
    "favicon": "",
    "content_for_index": [

    ]
  },
  "presets": {
    "Default": {
      "color_text": "#3d4246",
      "color_body_text": "#788188",
      "color_sale_text": "#7796A8",
      "color_borders": "#e8e9eb",
      "color_button": "#7796A8",
      "color_button_text": "#fff",
      "color_small_button": "#fff",
      "color_small_button_text": "#3d4246",
      "color_text_field": "#fff",
      "color_text_field_text": "#000",
      "color_image_overlay_text": "#fff",
      "color_image_overlay": "#3d4246",
      "image_overlay_opacity": "0.25",
      "color_body_bg": "#fff",
      "type_header_family": "Google_Work+Sans_600_sans",
      "type_header_base_size": "26px",
      "type_base_family": "Google_Work+Sans_400_sans",
      "type_base_size": "16px",
      "type_bold_product_titles": false,
      "share_facebook": true,
      "share_twitter": true,
      "share_pinterest": true,
      "content_for_index": [

      ]
    },
    "Light": {
      "color_text": "#162950",
      "color_body_text": "#757575",
      "color_sale_text": "#ff574f",
      "color_borders": "#e4e4e4",
      "color_button": "#ff574f",
      "color_button_text": "#ffffff",
      "color_small_button": "#eaeaea",
      "color_small_button_text": "#162950",
      "color_text_field": "#ffffff",
      "color_text_field_text": "#162950",
      "color_image_overlay_text": "#ffffff",
      "color_image_overlay": "#3d3d3d",
      "image_overlay_opacity": "0.3",
      "color_body_bg": "#f8f8f8",
      "type_header_family": "Google_Muli_600_sans",
      "type_header_base_size": "26px",
      "type_base_family": "Google_Muli_600_sans",
      "type_base_size": "18px",
      "type_bold_product_titles": true,
      "share_facebook": true,
      "share_twitter": true,
      "share_pinterest": true,
      "social_twitter_link": "",
      "social_facebook_link": "",
      "social_pinterest_link": "",
      "social_instagram_link": "",
      "social_tumblr_link": "",
      "social_snapchat_link": "",
      "social_youtube_link": "",
      "social_vimeo_link": "",
      "favicon": "",
      "checkout_header_image": "",
      "checkout_logo_image": "",
      "checkout_logo_position": "left",
      "checkout_logo_size": "small",
      "checkout_body_background_image": "",
      "checkout_body_background_color": "#ffffff",
      "checkout_input_background_color_mode": "white",
      "checkout_sidebar_background_image": "",
      "checkout_sidebar_background_color": "#e8f3f6",
      "checkout_heading_font": "Roboto",
      "checkout_body_font": "Source Sans Pro",
      "checkout_accent_color": "#1990c6",
      "checkout_button_color": "#23314e",
      "checkout_error_color": "#ff6d6d",
      "content_for_index": [

      ]
    }
  }
}

settings_data.json - Original File contents:

{
  "current": {
    "color_text": "#3d4246",
    "color_body_text": "#788188",
    "color_sale_text": "#7796a8",
    "color_borders": "#e8e9eb",
    "color_button": "#7796a8",
    "color_button_text": "#fff",
    "color_small_button": "#fff",
    "color_small_button_text": "#3d4246",
    "color_text_field": "#fff",
    "color_text_field_text": "#000",
    "color_image_overlay_text": "#fff",
    "color_image_overlay": "#3d4246",
    "image_overlay_opacity": "0.25",
    "color_body_bg": "#fff",
    "type_header_family": "Google_Work+Sans_600_sans",
    "type_header_base_size": "26px",
    "type_base_family": "Google_Work+Sans_400_sans",
    "type_base_size": "16px",
    "type_bold_product_titles": false,
    "share_facebook": true,
    "share_twitter": true,
    "share_pinterest": true,
    "social_twitter_link": "",
    "social_facebook_link": "",
    "social_pinterest_link": "",
    "social_instagram_link": "",
    "social_tumblr_link": "",
    "social_snapchat_link": "",
    "social_youtube_link": "",
    "social_vimeo_link": "",
    "favicon": "",
    "checkout_header_image": "",
    "checkout_logo_image": "shopify:\/\/shop_images\/converse_logo.png",
    "checkout_logo_position": "left",
    "checkout_logo_size": "small",
    "checkout_body_background_image": "",
    "checkout_body_background_color": "#fff",
    "checkout_input_background_color_mode": "white",
    "checkout_sidebar_background_image": "",
    "checkout_sidebar_background_color": "#fafafa",
    "checkout_heading_font": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",
    "checkout_body_font": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",
    "checkout_accent_color": "#197bbd",
    "checkout_button_color": "#197bbd",
    "checkout_error_color": "#e32c2b",
    "sections": {
      "header": {
        "type": "header",
        "settings": {
          "align_logo": "left",
          "logo": "shopify:\/\/shop_images\/converse_logo.png",
          "logo_max_width": "180",
          "main_linklist": "main-menu",
          "message": false,
          "home_page_only": true,
          "message_text": "Announce something here",
          "message_link": "",
          "color_bg": "#7796a8",
          "color_text": "#fff"
        }
      },
      "hero": {
        "type": "hero",
        "settings": {
          "image": "",
          "alignment": "center",
          "title": "Image with text overlay",
          "text": "Use overlay text to give your customers insight into your brand. Select imagery and text that relates to your style and story.<\/p>", "hero_size": "medium", "text_size": "large", "button_label": "", "button_link": "" } }, "slideshow": { "type": "slideshow", "blocks": { "slideshow-0": { "type": "image", "settings": { "image": "", "alignment": "top", "title": "Image slide", "subheading": "Tell your brand's story through video and images", "link": "" } }, "slideshow-1": { "type": "image", "settings": { "image": "", "alignment": "top", "title": "Image slide", "subheading": "Tell your brand's story through video and images", "link": "" } } }, "block_order": [ "slideshow-0", "slideshow-1" ], "settings": { "autoplay": true, "autoplay_speed": "7000", "slideshow_height": "small", "text_size": "medium" } }, "featured-collections": { "type": "collection", "settings": { "title": "Featured collection", "collection": "frontpage", "grid": "3", "rows": "2", "show_vendor": false, "show_view_all": false } }, "feature-row": { "type": "feature-row", "settings": { "image": "", "layout": "left", "title": "Image with text", "text": "Pair large text with an image to give focus to your chosen product, collection, or blog post. Add details on availability, style, or even provide a review.<\/p>", "button_label": "", "button_link": "" } }, "footer": { "type": "footer", "settings": { "footer_linklist": "footer", "footer_linklist_two": "", "footer_newsletter_enable": false, "show_payment_icons": false } } }, "content_for_index": [ "hero", "featured-collections", "feature-row", "slideshow" ] }, "presets": { "Default": { "color_text": "#3d4246", "color_body_text": "#788188", "color_sale_text": "#7796A8", "color_borders": "#e8e9eb", "color_button": "#7796A8", "color_button_text": "#fff", "color_small_button": "#fff", "color_small_button_text": "#3d4246", "color_text_field": "#fff", "color_text_field_text": "#000", "color_image_overlay_text": "#fff", "color_image_overlay": "#3d4246", "image_overlay_opacity": "0.25", "color_body_bg": "#fff", "type_header_family": "Google_Work+Sans_600_sans", "type_header_base_size": "26px", "type_base_family": "Google_Work+Sans_400_sans", "type_base_size": "16px", "type_bold_product_titles": false, "share_facebook": true, "share_twitter": true, "share_pinterest": true, "sections": { "header": { "type": "header", "settings": { } }, "hero": { "type": "hero", "settings": { "text_size": "large" } }, "slideshow": { "type": "slideshow", "blocks": { "slideshow-0": { "type": "image", "settings": { } }, "slideshow-1": { "type": "image", "settings": { } } }, "block_order": [ "slideshow-0", "slideshow-1" ], "settings": { } }, "featured-collections": { "type": "collection", "settings": { "collection": "frontpage" } }, "feature-row": { "type": "feature-row", "settings": { } }, "footer": { "type": "footer", "settings": { "footer_linklist_two": "" } } }, "content_for_index": [ "hero", "featured-collections", "feature-row", "slideshow" ] }, "Light": { "color_text": "#162950", "color_body_text": "#757575", "color_sale_text": "#ff574f", "color_borders": "#e4e4e4", "color_button": "#ff574f", "color_button_text": "#ffffff", "color_small_button": "#eaeaea", "color_small_button_text": "#162950", "color_text_field": "#ffffff", "color_text_field_text": "#162950", "color_image_overlay_text": "#ffffff", "color_image_overlay": "#3d3d3d", "image_overlay_opacity": "0.3", "color_body_bg": "#f8f8f8", "type_header_family": "Google_Muli_600_sans", "type_header_base_size": "26px", "type_base_family": "Google_Muli_600_sans", "type_base_size": "18px", "type_bold_product_titles": true, "share_facebook": true, "share_twitter": true, "share_pinterest": true, "social_twitter_link": "", "social_facebook_link": "", "social_pinterest_link": "", "social_instagram_link": "", "social_tumblr_link": "", "social_snapchat_link": "", "social_youtube_link": "", "social_vimeo_link": "", "favicon": "", "checkout_header_image": "", "checkout_logo_image": "", "checkout_logo_position": "left", "checkout_logo_size": "small", "checkout_body_background_image": "", "checkout_body_background_color": "#ffffff", "checkout_input_background_color_mode": "white", "checkout_sidebar_background_image": "", "checkout_sidebar_background_color": "#e8f3f6", "checkout_heading_font": "Roboto", "checkout_body_font": "Source Sans Pro", "checkout_accent_color": "#1990c6", "checkout_button_color": "#23314e", "checkout_error_color": "#ff6d6d", "sections": { "header": { "type": "header", "settings": { "align_logo": "left", "logo": "", "logo_max_width": "135", "main_linklist": "main-menu", "message": true, "color_bg": "#162950", "color_text": "#ffffff" } }, "hero": { "type": "hero", "settings": { "alignment": "center", "hero_size": "x-large", "text_size": "large" } }, "slideshow": { "type": "slideshow", "blocks": { "slideshow-0": { "type": "image", "settings": { "image": "", "alignment": "center" } }, "1492095993817": { "type": "image", "settings": { "image": "", "alignment": "center" } } }, "block_order": [ "slideshow-0", "1492095993817" ], "settings": { "autoplay": true, "autoplay_speed": "6000", "slideshow_height": "medium", "text_size": "medium" } }, "featured-collections": { "type": "collection", "settings": { "grid": "3", "rows": "1", "show_vendor": true, "show_view_all": true } }, "footer": { "type": "footer", "settings": { "footer_linklist": "main-menu", "footer_linklist_two": "footer", "footer_newsletter_enable": true, "show_payment_icons": true } }, "product-template": { "type": "product-template", "settings": { "image_size": "medium", "show_quantity_selector": false, "show_variant_labels": true, "show_vendor": false, "enable_zoom": true, "show_share_buttons": true } }, "collection-template": { "type": "collection-template", "settings": { "layout": "grid", "grid": "2", "rows": "2", "show_collection_image": true, "show_vendor": false, "sort_enable": true, "tags_enable": true } }, "1492033809691": { "type": "map", "settings": { "show_button": true } }, "1492033877875": { "type": "quotes", "blocks": { "1492033877875-0": { "type": "quote", "settings": { } } }, "block_order": [ "1492033877875-0" ], "settings": { } }, "1492033924902": { "type": "custom-content", "blocks": { "1492033924902-0": { "type": "text", "settings": { "width": "100%", "alignment": "center", "align_text": "center" } } }, "block_order": [ "1492033924902-0" ], "settings": { "title": "" } }, "1492096252560": { "type": "collection-list", "blocks": { "1492096252560-0": { "type": "featured_collection", "settings": { } }, "1492096252560-1": { "type": "featured_collection", "settings": { } }, "1492096252560-2": { "type": "featured_collection", "settings": { } } }, "block_order": [ "1492096252560-0", "1492096252560-1", "1492096252560-2" ], "settings": { "grid": "3" } }, "blog-template": { "type": "blog-template", "settings": { "layout": "grid", "blog_show_author": true, "blog_show_date": false } }, "article-template": { "type": "article-template", "settings": { "blog_show_author": true, "blog_show_date": true, "show_share_buttons": true } }, "cart-template": { "type": "cart-template", "settings": { "cart_notes_enable": false } } }, "content_for_index": [ "hero", "featured-collections", "slideshow", "1492033924902", "1492096252560", "1492033877875", "1492033809691" ] } } }

 

Please would someone be able to advise on the correct way to achieve this?

 

Many Thanks

 

Accepted Solution (1)

Accepted Solutions
breakworm
Tourist
5 2 0

This is an accepted solution.

My solution was to copy the settings_schema.json first and the settings_data.json after copy all other assets to the new theme.

View solution in original post

Reply 1 (1)
breakworm
Tourist
5 2 0

This is an accepted solution.

My solution was to copy the settings_schema.json first and the settings_data.json after copy all other assets to the new theme.