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
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024