Search code examples
jsone-commercesquarespace

Squarespace Custom Product Post Type


I was thinking about creating different templates for products (not with different features but with different html organization and css) because the standard "pic on the left and data on the right" is not enough for a well-made user-centered ecommerce.

I tried the custom post types but they are blog post and can't access the product data.

in my custom product.conf i added my custom post data

 "acceptTypes" : ["store_item", "custom-product-item"]

but obv. it won't work.

maybe if I could access the store_item could be easier to do this, but i can't find on the repo.

anyone has some suggestion?


Solution

  • Unfortunately, although it used to be possible to create custom post type products, that stopped being possible within the last year or so.

    If you want to create your own template for products, you need to override the products.list and/or products.item files with your own. By placing them within your /collections folder, it will override the system default ones.

    That means you have to write it entirely from scratch. Here are a couple resources that may help (despite being outdated):

    Having overridden products.item, if you want to have different templates for different products, you can do something like:

    {.equal? item.urlId "myurlid1"}
      {@|apply products1.block}
    {.or equal? item.urlId "myurlid2"}
      {@|apply products2.block}
    {.or}
      etc.