Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
Can you please add sku and discount to [commerce-email:order-items]? Or is there a way to print this information in the template file?
Thanks for a great module,
Paul
Comment | File | Size | Author |
---|---|---|---|
#12 | commerce_email-add-discount-to-token-1332922-12.patch | 949 bytes | rossb89 |
#8 | without_patch_1332922.jpg | 4.06 KB | ptmkenny |
#8 | with_patch_1332922.jpg | 5.45 KB | ptmkenny |
#8 | commerce_email-add-discount-to-token-1332922-8.patch | 862 bytes | ptmkenny |
Comments
Comment #1
yaudouin CreditAttribution: yaudouin commentedSuscribe
Comment #2
Slacker CreditAttribution: Slacker commentedSubscribe!
Comment #3
kevster CreditAttribution: kevster commentedSubscribe - very useful for me!
Comment #4
TomGould01 CreditAttribution: TomGould01 commentedSubscribing,
A clinet wants this!
Comment #5
andyg5000See this thread: http://drupal.org/node/1532526 I've provided a sandbox module that creates a new token. You can use this module to create your own and edit to pull in the info you need.
Comment #6
dylanrao CreditAttribution: dylanrao commentedThanks 5000 andy, I was fighting this before I found your module. This probably should come out of sandbox, it seems like something Commerce mail should be capable of. SKU# are a pretty common requirement IMHO.
Comment #7
zpolgar CreditAttribution: zpolgar commentedAdd discount feature will be the super solution.
Comment #8
ptmkenny CreditAttribution: ptmkenny commentedI'm attaching a patch to add the discount to the token output. I didn't add the SKU because I did not need it (or want it) for my case; the SKU seems best left to a case-by-case basis.
However, in the case of discounts, I think that not showing the discount is a bug.
See the attached images. Since the "subtotal" and "total" are included, skipping the discount leads to the total being unexpectedly reduced, which can cause recipients to wonder if the discount was in fact applied.
Comment #9
Summit CreditAttribution: Summit commentedHi,
Thanks for adding discount.
Couldn't you add an option to y/n show sku.
I would love to have sku in the email.
Also for customer referral.
Greetings, Martijn
Comment #10
ptmkenny CreditAttribution: ptmkenny commentedIf you want to add SKU, referral, etc., you should check out the patch in #1332698: Allow theming of [commerce-order:commerce-email-order-items] (which has already been committed). You can write your own theme function for that.
My patch includes only the discount because the Subtotal and Total are already included, so omitting the discount can lead to very strange looking e-mails, which I think is a bug.
Comment #11
vrMarc CreditAttribution: vrMarc commentedThis line in the patch didn't work for me -
elseif ($data['components'][$key]['name'] == 'discount')
It turns out that I had to use 'commerce_coupon_the_name_of_the_discount_code' instead of 'discount'. Since new coupon codes would be added and I don't want to have to add each discount code to commerce_email.module, I used this instead -
elseif (strpos($data['components'][$key]['name'], 'commerce_coupon') !== false)
Comment #12
rossb89 CreditAttribution: rossb89 at ComputerMinds commentedMade a new version of the patch, to work with the newer version of commerce discount where the key is 'discount|machine_name_of_discount' not just 'discount'.
Takes into account the customer facing title configured for the discount as well.
Comment #13
IckZ CreditAttribution: IckZ commentedthanks a lot @rossb89: I've just noticed today, that the title is missing in the mails. I'm testing now your patch!
Comment #14
mrP CreditAttribution: mrP commentedPatch #12 applies cleanly and works for me with commerce_discount-7.x-1.0-beta5. Thanks!
Updating title to reflect the patch is for discount only. +1 RBTC
Comment #15
rszrama CreditAttribution: rszrama at Centarro commentedChecking to see if it still applies...
Comment #17
rszrama CreditAttribution: rszrama at Centarro commentedPatch checks out. Didn't test in local dev but committing based on community feedback.