Is it possible to create a new custom liquid object?

New Member
4 0 0

Let's say I want to create a custom liquid object called staff, wherein it stores business teams (i.e. marketing staff, sales team, etc) with information about their individual members.

 

Information may include names, titles, profile pictures, introductions, and URLs to their personal pages.

 

Is it possible to do that in the same way that there are global objects like blogs, collections, products etc? I kinda wanna use it to make a custom section that is represented and rendered in the HTML as an accordion for each created business team.  

0 Likes
Highlighted
Shopify Partner
245 9 49

You can only temporarily invent objects as part of the processing of the liquid code, each time the page is requested, you cannot 'persist' storage data over the long term, without putting into some database such as customers or customer metafields.

0 Likes
New Member
4 0 0

Does Shopify have some kind of API that I can use to write to the database and create my object from there?

0 Likes

What are you trying to accomplish with this 'teams' concept?  Is it a staff team?  Or customer teams?  Is it presenting hierarchy or providing access?

Scott Austin
Owner of https://jadepuma.com
0 Likes
New Member
4 0 0

@Scott-Austin wrote:

What are you trying to accomplish with this 'teams' concept?  Is it a staff team?  Or customer teams?  Is it presenting hierarchy or providing access?


It's a staff team for the client company whose site I'm working on. It's presenting the hierarchy within their business organization. Not really providing access, kinda like what you would see in an About Us page from most sites, a "Meet the Team" concept.

0 Likes

If its a team or about us page, you really don't need to store the information in a database.  Here are some options:

 

  1. https://solti.com/pages/team - this a team page a made for a client a while back.  In this case, I created a new section using liquid and added it the theme.  That way, it is easy for the store staff to add, edit, change the order, and remove people from the page because each person is a block in the section.
  2. This one - https://www.organicosenlinea.com/pages/nuestro-equipo - is just done in HTML in the page's content.  So the store staff has to be a little more careful when editing.
  3. And this one - https://sevenseasroasting.com/pages/ambassadors - was done by using the Shopify blog feature.  Each person is a blog post.

That should give you some ideas on how to progress.

Scott Austin
Owner of https://jadepuma.com
0 Likes
New Member
4 0 0

@Scott-Austin wrote:

If its a team or about us page, you really don't need to store the information in a database.  Here are some options:

 

  1. https://solti.com/pages/team - this a team page a made for a client a while back.  In this case, I created a new section using liquid and added it the theme.  That way, it is easy for the store staff to add, edit, change the order, and remove people from the page because each person is a block in the section.
  2. This one - https://www.organicosenlinea.com/pages/nuestro-equipo - is just done in HTML in the page's content.  So the store staff has to be a little more careful when editing.
  3. And this one - https://sevenseasroasting.com/pages/ambassadors - was done by using the Shopify blog feature.  Each person is a blog post.

That should give you some ideas on how to progress.


True, but I wanted to make a section that renders itself as an accordion separated by business teams. It would be a lot simpler if I could just pull each business team into it like how you would a collection of products or a collection of blogs and loop from there. But I suppose I have to work within the limits of the platform. The concept is like a Custom Post Type, akin to what Wordpress has.

0 Likes

If a system already existed that stored the data in the structure that you wanted and then rendered it the way you wanted, that could be easier.  But I don't think that exists.  

 

So you just need to code it yourself.  As for showing it in accordion fashion, that is totally possible.  Here is a blank accordion layout with sections - https://www.vizartink.com/pages/frequently-asked-questions.  This comes built-in to the Turbo theme, and can be added to any theme that doesn't have it built-in.

Scott Austin
Owner of https://jadepuma.com
0 Likes