Personalized checkout and custom promotions with Shopify Scripts
I could be wrong, but I think there's an error in the example scripts for the Script Editor that's bloating CPU usage. The TieredPricingCampaign class has a section that reads:
applicable_items = cart.line_items.select { |line_item| product_selector.match?(line_item) }
next if applicable_items.nil?
However, when you print the applicable_items, a non-applicable line item prints an empty set instead of Nil. I swapped out nil? for empty? and it cut my CPU usage nearly in half.
Let me know if I'm missing something bigger picture about why it should be nil
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