Sha256: 52ae9e0227c9514ac91e063f029e9434f71b259a50fa85f5eef00afe86e8084a
Contents?: true
Size: 549 Bytes
Versions: 9
Compression:
Stored size: 549 Bytes
Contents
module Spree module TrackersHelper def product_for_segment(product, optional = {}) { product_id: product.id, sku: product.sku, category: product.category.try(:name), name: product.name, brand: product.brand.try(:name), price: product.price, currency: product.currency, url: product_url(product), }.tap do |hash| hash[:image_url] = asset_url(optional.delete(:image).attachment) if optional[:image] end.merge(optional).to_json.html_safe end end end
Version data entries
9 entries across 9 versions & 1 rubygems