Personalized checkout and custom promotions with Shopify Scripts
Hi Community
Having errors on the below script on the RATE line. New to Ruby so wanting to check prior to having a go at modifying it.
# Customer Tag Discounts CONSULTANT = 'consultant' TEAM_LEAD = 'team_lead' STAFF = 'staff' $customer_tag = '' if !Input.cart.customer.nil? if Input.cart.customer.tags.include?(CONSULTANT) $customer_tag = CONSULTANT elsif Input.cart.customer.tags.include?(TEAM_LEAD) $customer_tag = TEAM_LEAD elsif Input.cart.customer.tags.include?(STAFF) $customer_tag = STAFF end if $customer_tag != '' Input.cart.line_items.each do |line_item| line_item.variant.product.tags.each do |tag| if tag.include?($customer_tag) RATE = (tag[(tag.index(':') + 1)..-1].to_f) / 100 line_item.change_line_price(line_item.line_price - (line_item.line_price * RATE), message: $customer_tag) end end end end end
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025