Customers

Overview

 

Name Description
customer.full_name The customer's full name
customer.first_name The first name of the customer
customer.last_name The last name of the customer
customer.email Customer's email
customer.pay_taxes If the customer pays taxes
customer.see_taxes_in_webshop If the customer can see taxes in webshop
customer.company The company of the customer
customer.organisation_number Organisation number of the customers company
customer.phone Phone number of the customer
customer.alternative_phone Alternative phone number
customer.use_bill_address If bill address is the same as shipping address
customer.ship_address Address drop
customer.shipping_address Alias for ship_address
customer.bill_address Address drop
customer.billing_address Alias for bill_address
customer.locale Locale registered with the customer and used in the emails.
customer.register_url URL for customer registration
customer.login_url URL for customer login
customer.logout_url URL for customer logout
customer.update_url URL for customer profile update
customer.lost_password_url URL for customer lost password
customer.reset_password_url URL for customer reset/change password
customer.edit_lost_password_url Does the same as reset_password_url
customer.invitation_url URL for customer invitation
customer.welcome_url URL for customer welcome
customer.show_taxes_url URL for updating show_taxes cookie. Use 'show' param with true/false or 1/0
customer.exists? Checks if the customer exists/ is logged in
customer.logged_in? Does the same as exists?
customer.orders Array<OrderDrop>
customer.dynamic_fields DynamicFieldsDrop
customer.current_contract Active contract
customer.ongoing_contracts Array<ContractDrop> with ongoing contracts
customer.all_contracts  Array<ContractDrop> with all contracts
customer.primary_account? Boolean
customer.customer_accounts Returns all accounts for customer
customer.customer_group Returns groups for customer
 

Customer tax visibility 

When you have a webshop were you both have customer that should see prices including tax, and customer that should see without tax you may want to add a button for the user to be able to switch between the two.

{% wm3form customer.show_taxes_url %}
  <input name="show" type="hidden" value="true">
  <button type="submit">Private</button>
{% endwm3form %}

 


Customer modules

There are internal modules for customers to be found under Webshop -> Configuration -> Partner. These modules concerns a wide variety of special features related to the customers, products and even the Community-module

 


Notification and error messages

These are available in register and profile page

{% if customer.notifications.exists? %}
  {% for alert in customer.notifications.by_type.alert  %}
    <div class="alert default-message">{{ alert.message }}</div>
  {% endfor %}
{% endif %}

# OR 

{% if customer.notifications.exists? %}
  {% for alert_message in customer.notifications.alert_messages  %}
    <div class="alert default-message">{{ alert_message }}</div>
  {% endfor %}

  # OR

  <div class="alert default-message">{{ customer.notifications.alert_messages | join: '</div><div class="alert default-message">' }}</div>
{% endif %}

Magic links

Magic links allow accounts to be logged in without passwords. This is should be used with caution but it allows very powerful interactions. Only customer accounts can be logged in, so it is only available on customer account drops.

Name Description
self_login_link Allows the current customer to log in. Since you have to be logged in to get it, it might not seem very useful. However, it lasts for a day and by storing it for later; in local storage for instance; it allows you to log back in as yourself.
agent_login_link This allows you to log in as a client, provided you are allowed to log in. Once you do, you are completely logged in as that account. It would be useful to store away self_login_link before, to make returning easy.
magic_login_link This allows logging in as any customer account. Don't use this unless you really know what you are doing. It lasts only five minutes and is primarily intended for password_reset mail, where it can present an option to skip the whole login/password problem just by using your mail as validation instead of password.

The magic_login_link has a few extra features. First by default it uses "https://<subdomain>.wm3.se" as domain for the link. It can be nicer to use the main domain instead, which can be done by:

    {{ customer_account.magic_login_link.with_host["https://example.com"] }}
  

Secondly, by default it sends to to the main index page for the site. It might be useful to send them to a specific landing site:

    {{ customer_account.magic_login_link.with_redirect["/my/landing/page"] }}
  

Updated: 2023-03-17