Witty and insightful observations on the world? Sorry to disappoint, this is a techie blog purely for self reference - published online in the hope it will help others!

Post Affiliate Pro Shopify Saletracking

Post Affiliate Pro have a plugin for Shopify and a handy guide here -> https://www.postaffiliatepro.com/integration-methods/integration/shopify/ There are a few issues with their plugin though. Firstly there's no option to include a Campaign ID, so your clicks will default back the default campaign. Not too much of a problem if you don't have any commissions on clicks, but it is an issue if you do (and a big issue if your rates are different between campaigns). I've made a feature request (this is a bug imo though) to Quality Unit Support, maybe it'll get fixed by the time you read this. In this case you'd have to add the click tracking script into the theme, which is a ... Read more

Setting up Shopify on Theme Kit

The Shopify documentation is very thorough. That said, however extensive documentation is, there is always room for confusion. Let's take the set up for ThemeKit. You've created your private app in both your development site in your Shopify partners account, and also the live site What issues might confuse you. Let's work through them; Theme Id What is it? My first thought was that I had to generate this ID myself, but of course it has ... Read more

Shopify – Close Drawer On Scroll

It's obviously a design decision that's been taken at some point - when you open the cart drawer on Timber scrolling is disabled. Can't say I agree with it though, it's more usual UX to have a minicart or drawer close when the user starts scrolling. To re-enable scrolling you need to remove; From assets/timber.scss.liquid. I've used this answer to add a timer to stop the scroll event firing all the time and affecting performance. var scrollTimer = null; $(window).scroll(function () { if (scrollTimer) { clearTimeout(scrollTimer); // clear any previous pending timer } scrollTimer = setTimeout(handleScroll, 100); // set ... Read more

Shopify – Updating Cart Drawer When Open

Note: This applies to themes built on Timber, it may not work on your theme. This was easy to fix, but only because user Benecke who opened an issue on GitHub was good enough to come back later and update what he did to actually fix the issue. The only thing worse than not doing that is coming back and writing Thanks, problem solved! without actually explaining what they did to solve it. Damn those fools to hell!! https://github.com/Shopify/Timber/issues/618 And you'd include that at the end of the $.ajax({}) method in the snippets/ajaxify-cart.liquid file; // Add to cart. $.ajax({ url: _config.shopifyAjaxAddURL, dataType: 'json', type: 'post', data: $addToCartForm.serialize(), success: ... Read more

Exclude Variant Images in Shopify

To my chagrin, I cannot now find the post where I got this code - unknown generous developer, I apologise. This kind of illustrates a point though - I got lucky finding that post. If you are reading this, you got lucky finding this post. In terms of organisation, curation and outright findability, Shopify University is no Stackoverflow, that's for sure. There are even people selling Apps at $5 a month for this simple code change. You've got a product, you have product variants, those product variants have images, you don't want those images appearing in the main carousel/gallery for the product. So, how do you exclude product variant images in the product.liquid template? Easy; {% for image in product.images %} ... Read more

Advanced Custom Fields in Shopify

If you've spent any time developing Wordpress themes you'll more than likely have come across Advanced Custom Fields by Ellion Condon. Being a hater of content builder plugins I remember being resistant to it when I was first shown it by another developer. In the end I bought the Pro licence and I've used it on every theme I've built since. It's the first plugin I install, I find it indispensible. So when I started building Shopify themes, and realised pretty quickly that the theme structure was very similar to Wordpress, I looked for a way to handle meta data based options in the Shopify backend. Step forward Read more

Update cart contents counter after Ajax update

A short post that will hopefully be helpful to somebody - I've had to write this because Shopify have an annoying policy of closing old forum threads when it'd be more useful to keep them open and have them updated. This thread; https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/how-do-i-update-the-cart-counter-immediately-via-ajax-268966 Has an outdated solution for the problem. Problem If you enable the Ajax updating in the drawer / minicart in Shopify you can update the quantities of the individual items in the cart. But you may have a small cart total items icon in your link to that minicart - how to update that without a page refresh? The Solution Part 1 - Collections page If you ... Read more

Shopify – Using Nested Menus in Theme

This is a good article for store owners on the basics of creating a nested menu in the Shopify backend; https://help.shopify.com/en/manual/sell-online/online-store/menus-and-links/drop-down-menus Wordpress site owners and developers will recognise this setup immediately. Draggable/droppable menus were introduced into Wordpress as one of the flagship features of Wordpress 3 in 2010. As always the Shopify documentation is good - an indeed the example used for nested menus shows how to do it for a three level nested menu; https://help.shopify.com/en/themes/development/building-nested-navigation However.... It's not an actual working example per se so I've done one here if you are putting together a nested menu on your theme. This is a two level example, if you need a three level menu I'd be recommended they try to recategorise ... Read more

Shopify Custom Links in Navigation

One of the issues when working with an system is that visual redesigns tend to render 'How To' blog posts obsolete pretty quickly. Hopefully this on won't stay obsolete too long. If you are trying to work out how to add a custom menu link to a Shopify menu and are getting frustrated, chances are it's a UX issue. This wiki; https://help.shopify.com/en/manual/sell-online/online-store/menus-and-links/editing-menus Tantalisingly talks about being able to create menu links to external websites but when you try and do it you find it won't work. What you need to do is paste in the url (let's use a link to the customer account page in this example); https://mydevsite.myshopify.com/account/register Into the input field. Then, you need to wait for that link to ... Read more

WordPress under Magento multistore

This is a 'Note to Self' as much as anything else. It's explains how we got the Wordpress install to work on a Magento multistore using country stub directories. The SO question it relates to is here; http://stackoverflow.com/questions/32613815/htaccess-wordpress-under-magento-site-with-multi-language-sub-directories We have this in production, hopefully this answer might help someone at some point. The way we've done this is to add a RUN_CODE environmental variable which is used in a custom Wordpress filter to get the urls all working. I've used the 'eu' example from my question to illustrate it below. Note we had to do this for both Apache and Nginx so I've added the .htaccess and server blocks for both. APACHE - .htaccess In the `eu` country stub subdirectory you add this ... Read more

Categories