Personalized checkout and custom promotions with Shopify Scripts
Hi,
Adding the RegExp class to Shopify Scripts API would open up a lot of additional functionality in Shipping Script in particular that is currently either difficult or impossible to do with the existing API. For instance RegExp would allow for:
Right now the only string tests I'm aware of are ==, starts_with? and ends_with? which makes for difficulty in correctly testing the first use case mentioned above. Instead of
Input.cart.address1 =~ /^(p\.*o\.*|box)/i || Input.cart.address2 =~ /^(p\.*o\.*|box)/i
I have to generate all of the possible combinations of characters matching that RegExp (with something like https://github.com/teeshop/rexgen) and add them to an array to then test with .starts_with?. This is very hackey and could be easily resolved with assess to RexExp functionality builtin to the script API.
This would help solve the long standing PO box issue and other I'm sure as well. Please add RexExp to the list of available classes in the Shopify Script API. Thanks!
Cheers,
Brad
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025