Add comma separated values in Shopify custom fields

hey Team

We are working for a shopify site selling kitchen utensils. We just setup Shopify Algolia and works everything as expected.
There are a few custom fields for products, like purpose, metal etc.
How to add multiple data in these custom fields(seems they are basically metafields), we would like to list our products in the corresponding refinements.

Example

Product - 1
Name - Product - 1
Purpose - Camp
Metal - Iron, Fibre

Product - 2
Name - Product - 2
Purpose - Camp, Kitchen
Metal - Wood

Product - 3
Name - Product - 3
Purpose - Travel
Metal - Glass

So the refinement list should be

Purpose

  • Camp
  • Kitchen
  • Travel

Metal

  • Iron
  • Fibre
  • Wood
  • Glass

Now Camp, Kitchen is listing as a single separate new option, how can we make Algolia to detect it as seperate options

I’m not completely sure I understood your questions.
Could you show us how you add those fields to a product.

If I got it right, the issue is that you store both information in a single metafield.

There is unfortunately no filtering parameters for our refinements list. We’re relying on what the Algolia API sends back to us, and this is one list of facets per attribute declared as a facet.

I see two solutions:

  1. Create 2 metafields instead of one. One called Purpose, the other called Metal.
  2. Or simply change the title of the refinement list to something more general, like “Tags”.

Yeah, its already two different custom fields(metafields), lets ignore Metal field for now.
How to add multiple values in Purpose field.
Say - I have to include Product 2 in both Camp and Kitchen(separate options in refinement list), how to add data in Purpose field for to achieve this.
Can we use something like array type metafield to achieve this

Product - 1
Purpose-2

Product - 2

Purpose

So our refinement list should be

Purpose

  • Camp(2)
  • Kitchen(1)
  • Travel(1)

But now we are getting like this

Purpose

  • Camp(1)
  • Camp,Kitchen(1)
  • Travel(1)

Thanks for clarifying how you add them.
Indeed, Shopify doesn’t support array for metafields.

I’ve just added a feature to do just this.
See https://community.algolia.com/shopify/metafields.html#metafield-options for more details.

Note: a reindex is required after activating the feature.