tmslnz / gulp-shopify-theme

Shopify theme synchronisation during development
Apache License 2.0
24 stars 6 forks source link

Checkout liquid template not updating on theme #9

Open OwenLD opened 4 years ago

OwenLD commented 4 years ago

When saving the checkout.liquid file locally it queues and gets added without any errors but it doesn't update the file on the shopify store.

Other files in the layout folder are updating as expected (theme.liquid etc).

Any idea as to why this is happening?

tmslnz commented 4 years ago

That may be because you are not a Shopify Plus customer?

OwenLD commented 4 years ago

The store I am working on is a plus store.

The specific gulp task looks like this:

/* Paths */
const paths = {
    copy: {
        src: ['src/{layout,config,snippets,sections,templates,locales}/**/*.*', '!src/config/settings_data.json'],
        watch: ['src/{layout,config,snippets,sections,templates,locales}/**/*.*', '!src/config/settings_data.json'],
        dest: 'dist'
    }
};

/* Copy */
function copy() {
    return gulp.src(paths.copy.src)
        .pipe(changed(paths.copy.dest))
        .pipe(gulpif(destCheck, embedSvg({
            root: 'dist/assets',
            selectors: '.inline-svg'
        })))
        .pipe(gulp.dest(paths.copy.dest))
        .pipe(theme.stream());
}

The copy function is then part of my watch/deploy tasks.

Which both run without erroring when editing the checkout.liquid locally.

The output in the terminal looks like this:

[13:55:41] Starting 'copy'...
[13:55:41]   gulp-shopify-theme   queued: layout/checkout.liquid
[13:55:42]   gulp-shopify-theme   added: layout/checkout.liquid
[13:55:42]   gulp-shopify-theme   Done
[13:55:42] Finished 'copy' after 562 ms
[13:55:42] Starting 'browserSyncReload'...
[13:55:42] Finished 'browserSyncReload' after 274 μs

Can you think of any other reason why this might not be working?

tmslnz commented 4 years ago

Looks like checkout.liquid is being added according to the console… That’s weird API behaviour if it doesn’t show up in the Shopify editor.

Is there any info out there on Shopify’s API docs that refers to special behaviour with checkout.liquid?

Maybe try a simple API call with cURL just for that file to rule out Shopify being the cause of the issue.

Sorry, not really sure how to help off the top of my head. There isn’t any magic sauce in the Gulp module…

OwenLD commented 4 years ago

I've just tested the API call with cURL and a very simple checkout.liquid file, which looked like this:

<!DOCTYPE html>
<html>
    <head>
        {{ content_for_header }}
    </head>
    <body>
        {{ content_for_layout }}
    </body>
</html>

The API call with cURL works as expected and the file updates on the theme.

However, using the exact same content with gulp doesn't seem to do anything but also doesn't error (same output as above).

Strange that this is only an issue with the checkout.liquid file... I can't find any information about it requiring any special behaviour.

Would be interesting to know if anyone else is having the same issue.

tmslnz commented 4 years ago

Thanks for looking into this. Weird one… I wonder if it could be something to do with the way the asset paths are built in my module?

OwenLD commented 4 years ago

Could be, I am not sure to be honest.

I wouldn't really know how to start debugging this.

Sorry I can't provide more information.

MrSpecific commented 3 years ago

@OwenLD - I just wanted to jump in and confirm your experience. We have a theme that uses Gulp Shopify Theme and we experience the EXACT same behavior. We have not been able to troubleshoot it, either, so we resort to using ThemeKit directly for that, or copy/pasting the file contents into the online editor.

nijotz commented 3 years ago

I'm encountering this too. I debugged this and it turns out the Shopify API is returning a 200 for the asset update call. This library calls out to the Shopify API here and then the Shopify API is making the request and getting a response here. I checked the response we were getting and it's a 200, normal JSON body, no errors, but the template is not updated in the Theme Editor..