I need increase, Magento default {{var qty}} is like 1 or 10 or 100. now i want to increase the digits purchased qty 1 means = 000001 and same for 10= 000010 for 100 = 000100 need to add 0's in front on EMAIL TEMPLATE only. Need to increase the digits. please help ! thanks in advance

  • you can use printf('%06d', $id); to add leading zeroes
    – Robin
    Aug 19, 2016 at 14:45
  • @Anja It's not possible to add PHP code inside the mail template ...
    – Alex
    Aug 19, 2016 at 19:49

1 Answer 1


I think there is no easy possibility for this. You could add an own email template directive to accomplish that as described here:

How can an extension add transactional email variables? (available in email templates)

The directive would simply contain Anja's code (printf('%06d', $qty);)

  • I cannot understand , on that link can you explain me, How can i get it so?
    – Crock
    Aug 20, 2016 at 4:13
  • Is any possible to assign a new variable for email template. i need this for only one email . not for all the email template. please guide me how can i create new custom variable to get the qty and which file have to add the custom code to get the all qty.
    – Crock
    Aug 20, 2016 at 5:56
  • as anyone knows, how can i get it? please help me.
    – Crock
    Aug 22, 2016 at 5:26
  • It is described pretty well in the link I provided - how far did you come?
    – Alex
    Aug 22, 2016 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.