Answered

Handlebar Helpers to remove end digits from coupon code?

Hello,

I'm working on some custom flows between Google Shopping and NetSuite. The last piece I need is to get our promo codes to come in correctly.

My issue is that promo codes in Google Shopping often have 2 additional digits that are not in the promo codes in NetSuite. For instance, a promo code may be called "EXAMPLE12" in NetSuite, while in Google Shopping the promo code "EXAMPLE1234". This obviously prevents an exact match from being found in NetSuite for these promo codes.

I need to come up with a rule that will trim off these last two digits. Our promos in NetSuite are always characters followed by 2 digits, so by eliminating an extra digits at the end we can get exact matches to our NetSuite promos every time.

Does anyone know how I would be able to accomplish this with handlebar helpers? 

Thank you in advance to anyone who can help.

1

Comments

2 comments
Date Votes
  • Hi, Jake Naydock.

    Borrowing from a recent post, I think this snippet should trim the last couple chars as expected:

    {{substring coupon 0 (subtract coupon.length "2")}}

     

    1
  • Hi Stephen Brandt,

    This is excellent, thank you so much! I will give this a try, and will update this post if it works. Hopefully it will help someone else in the future as well.

    1

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post