Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
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
User | RANK |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |