Jump to content

(Solved) How to truncate output of javascript


Whispar1

Recommended Posts

Okay I have a small script that adds the product description to a rich pin. However, the description is too long so how do I truncate the output?

 

I tried:  text: '{$product->name} {$product->description | truncate:200}'  but of course resulted in an error

 

Original script:

<script type="text/javascript">
AddShoppersTracking.coupons = {
        pinterest: {
            text: '{$product->name} {$product->description}'
        }
    };
</script>
Edited by Whispar1 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...