remove_prop

Removes a property from an object. Modifies the object in place and returns it.

{% assign cleaned = product_data | remove_prop: "internal_notes" %}
{% log cleaned %}

Syntax

{{ object | remove_prop: property_name }}
Parameter
Description

object

Object to remove the property from

property_name

Name of the property to delete

Return Value

Returns the object with the specified property removed.

Examples

Remove sensitive data before logging:

{% assign safe_data = api_response | remove_prop: "api_key" %}
{% log safe_data %}

Clean up an object before sending to an API:

{% assign payload = order_data | remove_prop: "internal_id" %}
{% assign payload = payload | remove_prop: "debug_info" %}
{% log payload %}

Remove a temporary property:

Strip metadata before returning from a function:

Notes

  • Modifies the object in place — the property is permanently deleted

  • Returns the object unchanged if the property does not exist

  • Returns the input unchanged if it is not an object

  • Only removes top-level properties — does not support dot notation for nested properties

Last updated