Expected String to be a Hash: properties

I’m trying to add html code to my store to create an add name box but when i press the add to cart button ‘!expected String to be a Hash: properties’ comes up.

How do I solve this?

I added the bottom 4 lines of code below ‘variant picker’

{%- when ‘variant_picker’ -%}
{% render ‘product-variant-picker’, product: product, block: block, product_form_id: product_form_id %}

Add Name

<input type=“text” id=“custom-name” form="{{product_form_id}}"name=“properties”[Add Name]/>

Thank for your help.

Hi @ProuWarrior

The error message “!expected String to be a Hash: properties” typically occurs when there’s an issue with the format of the properties being passed to the Shopify cart. To resolve this error, you need to ensure that the properties are formatted correctly. Here’s how you can modify the code to fix the issue:

Replace the following line:


With the updated code:


In the modified code, the properties value is placed inside square brackets and followed by an equal sign. This ensures that the “Add Name” value is correctly passed as a property to the cart.

Make sure to include the correct product form ID (product_form_id) in the form attribute of the input field.

After applying these changes, the “!expected String to be a Hash: properties” error should be resolved, and the “Add Name” value should be sent as a property to the Shopify cart.

Remember to thoroughly test the functionality to ensure that the custom name is correctly added to the cart for the selected product.

I hope this helps! Let me know if you have any further questions.

1 Like

Thank You! Problem solved. :grin:

Hey, I still have this problem. do you maybe now how I can fix this. I dont know where to add the code. i have it for all of my products