Personalized checkout and custom promotions with Shopify Scripts
I'm noticing that there are changes being made to scripts that are posted. This causes errors in the script and makes it harder for Shopify Partners to help merchants.
EXAMPLE
@tags = tags.map { |tag| tag.downcase.strip } is changed to @Tags = tags.map { |tag| tag.downcase.strip }
@selector_type = selector_type is changed to @Selector_type = selector_type
I am testing this script (http://www.kaliara.com/test-script.rb) here... which seems to work
# ================================================================
# CustomerTagSelector
#
# Finds whether the supplied customer has any of the entered tags.
# ================================================================
class CustomerTagSelector
def initialize(match_type, tags)
@comparator = match_type == :include ? 'any?' : 'none?'
@tags = tags.map { |tag| tag.downcase.strip }
end
def match?(customer)
customer_tags = customer.tags.map { |tag| tag.downcase.strip }
(@tags & customer_tags).send(@comparator)
end
end
# ================================================================
# ProductSelector
#
# Finds matching products by the entered criteria.
# ================================================================
class ProductSelector
def initialize(match_type, selector_type, selectors)
@match_type = match_type
@comparator = match_type == :include ? 'any?' : 'none?'
@selector_type = selector_type
@selectors = selectors
end
def match?(line_item)
if self.respond_to?(@selector_type)
self.send(@selector_type, line_item)
else
raise RuntimeError.new('Invalid product selector type')
end
end
end
POSSIBLE CAUSES
I think the forum is trying to turn those into "at mentions" and is picking out a few words (like tag and selector) because they must match some user or something.
Any help from @Jason or Shopify would be great!
Thanks,
Matthew
Doesn't seem to be happening in the post above, but it occurred multiple times in this post: https://community.shopify.com/c/Script-Editor/Shipping-Script-to-hide-shipping-options-based-on-prod...
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025