diff --git a/app/views/spree/api/variants/units_show.v1.rabl b/app/views/spree/api/variants/units_show.v1.rabl index 326508bd4a..634213e53f 100644 --- a/app/views/spree/api/variants/units_show.v1.rabl +++ b/app/views/spree/api/variants/units_show.v1.rabl @@ -1,4 +1,9 @@ object @variant attributes :id -node( :unit_text ) { |v| v.product.name + (v.options_text.empty? ? "" : ": " + v.options_text) } + +node( :unit_text ) do |v| + options_text = v.options_text + v.product.name + (options_text.empty? ? "" : ": #{options_text}") +end + node( :unit_value ) { |v| v.unit_value }