Forum
Shop promotions not applying in confirmation emails
Hi,
Using the Perch shop I have noticed that the promotions have not been applied in the order status emails sent out to customers, this seems to be affecting the comparison for showing the discount total and the grand_total_formatted
template variable.
The code in the email template uses the same structure as the cart total displayed at the checkout stage:
cart.html
<perch:if id="total_discounts" match="gt" value="0.00">
<dd class="receipt__label">
Discount
</dd>
<dt class="receipt__cost">
- <perch:shop id="total_discounts_formatted" />
</dt>
</perch:if>
<dd class="receipt__label">
Tax
</dd>
<dt class="receipt__cost">
<perch:shop id="total_tax_formatted" />
</dt>
<dd class="receipt__label receipt__total">Total</dd>
<dt class="receipt__cost receipt__total">
<perch:shop id="grand_total_formatted" />
</dt>
order_paid.html (email)
<perch:if id="total_discounts" match="gt" value="0.00">
<tr style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px;">
<td style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; padding: 8px 0; border-top: #D6EFEC 1px solid;">
Discount
</td>
<td class="alignright" style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; text-align: right; padding: 8px 0; border-top: #D6EFEC 1px solid;">
- <perch:shop id="total_discounts_formatted" type="hidden" />
</td>
</tr>
</perch:if>
<tr style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px;">
<td style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; padding: 8px 0; border-top: #D6EFEC 1px solid;">
Tax
</td>
<td class="alignright" style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; text-align: right; padding: 8px 0; border-top: #D6EFEC 1px solid;">
<perch:shop id="total_tax_formatted" type="hidden" />
</td>
</tr>
<tr class="total" style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px;">
<td class="alignright" width="80%" style="margin: 0; box-sizing: border-box; font-size: 14px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; vertical-align: top; text-align: right; padding: 8px 0; border-top: 2px solid #35AD9F; border-bottom: 2px solid #35AD9F; font-weight: 700; color: #35AD9F;">Total</td>
<td class="alignright" style="margin: 0; box-sizing: border-box; font-size: 14px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; vertical-align: top; text-align: right; padding: 8px 0; border-top: 2px solid #35AD9F; border-bottom: 2px solid #35AD9F; font-weight: 700; color: #35AD9F;">
<perch:shop id="grand_total_formatted" type="hidden" />
</td>
</tr>
The promotion is set up to offer free shipping. The total should be displayed as £10.00 but is output as £12.95 in the email. Using the latest shop 1.0.10.
The shop is currently live and obviously this isn't ideal for customers not to be shown applied discounts.
Diagnostics:
Diagnostics report
PERCH INFORMATION
Perch Runway: 2.8.32
Production mode: Production (100)
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), root_analytics (1.0.1), perch_forms (1.8.3), perch_shop_orders (1.0.10), perch_shop_products (1.0.10), perch_shop (1.0.10), perch_members (1.5), root_artithmetic (1), root_breadcrumbs (1.0), perch_mailchimp (3.0.1)
DB driver: PDO
DB tables: perch2_backup_plans (0), perch2_backup_resources (0), perch2_backup_runs (0), perch2_categories (29), perch2_category_counts (0), perch2_category_sets (4), perch2_collection_index (0), perch2_collection_items (0), perch2_collection_revisions (0), perch2_collections (0), perch2_content_index (2013), perch2_content_items (252), perch2_content_regions (45), perch2_forms (2), perch2_forms_responses (1), perch2_mailchimp_campaigns (0), perch2_mailchimp_imports (0), perch2_mailchimp_lists (1), perch2_mailchimp_subscribers (1), perch2_mailchimp_subscriptions (1), perch2_mailchimp_webhooks (1), perch2_members (1), perch2_members_forms (1), perch2_members_member_tags (0), perch2_members_sessions (1), perch2_members_tags (0), perch2_navigation (4), perch2_navigation_pages (19), perch2_page_routes (6), perch2_page_templates (28), perch2_pages (32), perch2_resource_log (2011), perch2_resource_tags (8), perch2_resources (1750), perch2_resources_to_tags (64), perch2_root_analytics_cache (3), perch2_scheduled_tasks (11), perch2_settings (37), perch2_shop_addresses (8), perch2_shop_admin_index (126), perch2_shop_brands (6), perch2_shop_cart (2577), perch2_shop_cart_data (36), perch2_shop_cart_items (11), perch2_shop_countries (250), perch2_shop_currencies (152), perch2_shop_customers (1), perch2_shop_emails (2), perch2_shop_index (23150), perch2_shop_option_values (20), perch2_shop_options (1), perch2_shop_order_items (3), perch2_shop_order_promotions (0), perch2_shop_order_statuses (9), perch2_shop_orders (3), perch2_shop_orders_meta (0), perch2_shop_product_files (0), perch2_shop_product_option_values (541), perch2_shop_product_options (125), perch2_shop_product_tags (0), perch2_shop_products (688), perch2_shop_promotions (0), perch2_shop_search (285), perch2_shop_shipping_zone_countries (1), perch2_shop_shipping_zones (2), perch2_shop_shippings (4), perch2_shop_tax_exhibits (6), perch2_shop_tax_group_rates (1), perch2_shop_tax_groups (1), perch2_shop_tax_locations (1), perch2_shop_tax_rates (1), perch2_shop_variants (541), perch2_user_passwords (1), perch2_user_privileges (74), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
Users: 1
App runtimes:
<?php
$apps_list = [
'content',
'categories',
'perch_forms',
'perch_members',
'perch_shop',
'perch_mailchimp',
'root_breadcrumbs',
'root_arithmetic',
];
Scheduled tasks for perch_mailchimp: import_data (1 mins)
Scheduled tasks for root_analytics: root_analytics_fetch_comparisons (1440 mins)
Editor plug-ins: markitup, redactor
H1: 08bfd0c44a6a60ae38bf35a9268e0a07
L1: 48729459af5dd8f62aba38d76e6c3aa1
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #23AE9F
content_singlePageEdit: 1
helpURL: mailto:design@rootstudio.co.uk
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.31: done
perch_shop_update: 1.0.10
headerScheme: dark
update_runway_2.8.31: done
latest_version: 2.8.15
on_sale_version: 2.8.32
dashboard: 1
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
logoPath: /admin/resources/little-puds-and-co-logo-with-stars.png
perch_members_login_page: /account?r={returnURL}
perch_shop_price_tax_mode: exc
perch_shop_trade_price_tax_mode: exc
perch_shop_site_url:
perch_shop_product_url: /shop/product/{slug}
perch_shop_default_currency: 47
perch_shop_reporting_currency: 47
perch_shop_invoice_number_format: Order #%d
perch_members_update: 1.4
update_runway_2.8.32: done
perch_mailchimp_api_key:
perch_mailchimp_campaign_url: /mailchimp/campaign/{campaignSlug}
perch_mailchimp_secret: 20e37ed
root_analytics_namespace: Little Puds & Co
root_analytics_view_id:
root_analytics_credentials_json:
root_analytics_time_period: 90
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /home/suzanne/public_html
PERCH_DB_USERNAME: suzanne_perchu
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: suzanne_perch_shop
PERCH_DB_PREFIX: perch2_
PERCH_PRODUCTION_MODE: 100
PERCH_DEBUG:
PERCH_EMAIL_FROM: james@rootstudio.co.uk
PERCH_EMAIL_FROM_NAME: Root Studio
PERCH_LOGINPATH: /admin
PERCH_PATH: /home/suzanne/public_html/admin
PERCH_CORE: /home/suzanne/public_html/admin/core
PERCH_RESFILEPATH: /home/suzanne/public_html/admin/resources
PERCH_RESPATH: /admin/resources
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_RUNWAY: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/suzanne/public_html/admin/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
PERCH_SHOP_VERSION: 1.0.10
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile
HOSTING SETTINGS
PHP: 5.6.26
Zend: 2.6.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
MySQL server: 5.6.34
Free disk space: 80.76 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, calendar, ctype, curl, dom, fileinfo, filter, ftp, gd, hash, iconv, SPL, intl, json, mbstring, mcrypt, session, standard, mysqlnd, Phar, posix, Reflection, mysql, SimpleXML, sockets, imap, tokenizer, xml, xmlreader, xmlwriter, cgi-fcgi, PDO, pdo_sqlite, imagick, pdo_mysql
GD: Yes
ImageMagick: Yes
PHP max upload size: 200M
PHP max form post size: 12M
PHP memory limit: 256M
Total max uploadable file size: 12M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
CONTEXT_DOCUMENT_ROOT: /home/suzanne/public_html
DOCUMENT_ROOT: /home/suzanne/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTPS: on
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-gb
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: _ga=GA1.3.875184230.1479730398; PHPSESSID=64381520a7e050bd454cbf14252dff6d; cpsession=suzanne%3aFd4M1qUYgGPv7tJr%2ccd6028ead345fbfbf92e531688a7fa02; timezone=Europe/London; cmsa=1; cmssb=0; p_m=856c543c74da4490b1c4c0441724ca47c9395c7d; cookieconsent_dismissed=yes
HTTP_HOST:
HTTP_REFERER:
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50
PATH: /bin:/usr/bin
QUERY_STRING: extended
REDIRECT_STATUS: 200
REMOTE_ADDR: 81.130.131.129
REMOTE_PORT: 51476
REQUEST_METHOD: GET
REQUEST_SCHEME: https
REQUEST_URI: /admin/core/settings/diagnostics/?extended
SCRIPT_FILENAME: /home/suzanne/public_html/admin/core/settings/diagnostics/index.php
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
SERVER_ADDR: 162.251.83.56
SERVER_ADMIN:
SERVER_NAME:
SERVER_PORT: 443
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: Apache
SSL_TLS_SNI:
UNIQUE_ID:
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1479745901.66
REQUEST_TIME: 1479745901
argc: 1
Are the discount values shown in the template?
The full output of
<perch:showall/>
shows:I can see there are order shipping discounts here:
Though grand total is still outputting the wrong value:
and the overall discounts are not counted:
Sorry to bump, customers are currently placing orders and a few have queried the lack of discount on the emails they are receiving - is there anything we can do to quickly patch this our side?
That's interesting. And this was showing the correct values before going live?
Hi Drew,
I'd not tested this particular promotion configuration prior to going live as this is something the client has added post-launch. Previously I had discounted product price only and the emails did display correctly, so I think it may only be affecting 'Free Shipping' promotions. The
<perch:showall/>
logs in my previous post were taken from my development environment but the issue is affecting both.I'll post a screenshot of the current setup to see if you can replicate what's happening: https://www.dropbox.com/s/agmvbddrvp41z3p/Screen%20Shot%202016-11-24%20at%2009.12.04.png?dl=0
Edit: also, thanks for the replies - the forum seems pretty busy at the moment so your help is very much appreciated!
I'll see if I can reproduce it.
Hi Drew,
Have you been able to reproduce this issue?
No, I've not had a chance to look at it yet.
Ok - thanks for the reply.