If you aren't using merge codes on your site, you should be! They are a powerful feature that can really customize how you would like your site to appear. You can take a look at our current list of merge codes here.
However this article is about the mysterious "Custom merge code". This is really pretty easy and an incredibly useful tool!
Custom Merge Codes - Explained
A Custom merge code is a string of text. When put into the HTML of your website, it generates information pending on the code. These custom merge codes are incredibly useful if you have information that repeats across the site. For example, a table used multiple times, or a list of link/pictures. So lets learn how to create one!
How do I see my list of Custom Merge codes?
What you'll want to do is log into the admin panel of your store. From here, go to Content > Power Features > Custom Merges. You can click on the star by any feature in the Power Features, and they'll show under the correct overlay in the future. For example, if you click the star by Custom Merges, in the future you can just go to Content > Custom Merges.
Here you'll see a list (or not if you haven't made any yet!) of custom merge codes. To create a new merge code, click NEW in the top right.
Here you'll want to name your merge code. Its important to name it something that is recognizable to you, so you can easily look at the merge code and know what it does. After this, you can fill in the content for the information you'd like to display. If you are looking to edit this as HTML, click on the left button in the text editor to input HTML.
After putting in the content, make sure to Save it in the top right!
When you save in the overlay, the overlay closes and brings you to a list of merge codes. You should now see the merge code you just saved in this list.
All custom merge codes are named in this fashion ##SHAREDCONTENT[MERGECODENAME]## where MERGECODENAME is the name of your merge code.
Now what?
Congratulations! You just made a custom merge code, and you can put this almost anywhere in the HTML of your site. To do this, you will want to edit the HTML of the page you would like to have this input. Typically you do this by going to Themes > Your Theme > The page you want it on > HTML Editor
Now that I have it in the HTML of my home page, lets see how it looks on the front end!
Well that was easy as pie! Now I can go and put the ##SHAREDCONTENT[HELLO]## merge code in any part of the HTML, and the content will show!
Isn't technology amazing?
Comments
7 comments
This is an amazingly powerful feature -- for example, let's say you have slightly different layouts for some products. Instead of loading up each layout with the needed html, make a few custom mergecodes. This simplifies each layout's code and if you need to make an edit to the mergecode, only edit the source mergecode, not each layout.
Why not use mergcodes with hidden widgets? Because they don't jump cross-layout.
This is an extremely powerful function!!!
Apparently works in email templates too.
The only thing that would make these better would be the ability to provide arguments to the custom merge codes.
Brandon,
I'm not 100% sure what you mean by argument -- Could you elaborate on that? Sounds interesting.
--Austin
SPOS Support
Austin,
An argument similar to passing an argument to a function. For example, how you can pass arguments to the ##GOOGLECHECKOUT[size=small,bg=white,variant=text]## merge code.
Brandon,
We do have some merge codes that accept arguments such as that; however, the google checkout merge code does not. It sounds like a great idea. I recommend suggesting it as a feature enhancement at vote.sparkpay.com.
Cheers,
Austin
Brandon,
It is still valid! I was confusing it with `##GOOGLECONVERSIONTRACKINGASYNC##` which does not take arguments, as far as I'm aware.
-Austin
Please sign in to leave a comment.