Easy Digital Downloads: Force account creation by cart total

Force account creation in Easy Digital Downloads if the cart total reaches a certain amount.

Following on from yesterday’s force account creation by category or tag, here’s how you can force account creation at checkout by the cart total. Simply change the $limit variable in the code example below and the customer will be forced to create an account when this cart total is reached.

You can find more useful code snippets for Easy Digital Downloads in the EDD Code Snippet Library.

Easy Digital Downloads: Force account creation by category or tag

Force account creation in Easy Digital Downloads if any of the downloads in the cart belong to a specific download category or download tag.

Here’s how you can force account creation in Easy Digital Downloads if any of the downloads in the cart belong to a specific download category or download tag.

Simply add your download categories and tags into each of the arrays shown below.

You can find more useful code snippets for Easy Digital Downloads in the EDD Code Snippet Library.

Easy Digital Downloads: Show how much a customer has spent

Show a logged in customer how much they’ve spent, anywhere on your website.

Although Easy Digital Downloads shows the total spent for each customer under Downloads → Reports → Customers, there’s no way for a customer themselves to see how much they have spent.

The following code will allow you to show a logged in customer how much they’ve spent, anywhere on your website. You could show this on the customer’s purchase history page, or add it to a purchase history dashboard widget.

Copy and paste the following function (mind the opening PHP tag) into your child theme’s functions.php or custom plugin:

Then, you can simply call <?php echo sumobi_edd_get_total_spent_for_customer(); ?>

Alternatively, if you need to show only a specific customer’s total spent, you can pass a user ID into the function like this:

<?php echo sumobi_edd_get_total_spent_for_customer( 50 ); ?>

Easy Digital Downloads: Add username to customer details

This code snippet for Easy Digital Downloads adds the customer’s username to the “Customer Details” section on the payment screen, and links it through to the user’s profile.

This code snippet for Easy Digital Downloads adds the customer’s username to the “Customer Details” section on the payment screen, and links it through to the user’s profile. This is extremely useful when you need to quickly look up the user’s details associated with the payment, without having to search for the user from WordPress’ Users page.

24076-username-link

Copy and paste the following into your child theme’s functions.php (mind the opening PHP tag) or a custom plugin:

Easy Digital Downloads: Removing product notes

Learn how to remove product notes for all downloads or only specific downloads in Easy Digital Downloads

Easy Digital Downloads allows you to add product notes to your downloads. These notes show on the purchase confirmation page, the admin email and also in the customer’s purchase receipt.

A customer on the EDD forums requested how to remove these product notes, so shown below are two options. One to completely remove product notes for all downloads, and one to only remove product notes for specific downloads.

Copy and paste the snippet you need into your child theme’s functions.php or custom plugin. If you’re using the first option, make sure to pass your download ID’s into the array as shown.

Easy Digital Downloads: Link download titles at checkout to product pages

Learn how you can make each download title at checkout in Easy Digital Downloads link back to its single download page

By default, the download titles at checkout in Easy Digital Downloads do not link back to their respective download pages. In order to create a frictionless checkout process, it’s a good idea to remove as many distractions as possible, increasing the chance that the customer will complete their purchase.

In saying that, if you need to do this copy across the checkout_cart.php file from EDD’s templates folder and into your child theme’s edd_templates folder. On line 30 (the exact line number may change between EDD versions) find the line that looks like the following and modify:

AffiliateWP: Add extra payment meta to the exported referrals .csv file

Learn how to add payment meta from Easy Digital Downloads to AffiliateWP’s exported referrals .csv file

An AffiliateWP customer wanted to know how to add some extra payment meta to the exported .csv file from Affiliates → Tools → Export Referrals. For each referral that the .csv listed, they needed to show the customer’s (who the affiliate referred) first name, last name and email address.

Although the code to retrieve the payment meta is specific to Easy Digital Downloads, you can use the reference ID to retrieve the payment meta from whichever e-commerce system you are using with AffiliateWP.

The code

Copy and paste the following code (mind the opening PHP tag) into your child theme’s functions.php or better yet, place this code into a custom plugin.

Show a linked list of downloads in your emails with Easy Digital Downloads

Add a {downloads} email tag to Easy Digital Downloads to show a linked list of downloads in your emails.

An Easy Digital Downloads customer needed a way to output a simple list of linked downloads in their emails.

One example of why this can be useful is if you are using the excellent reviews add-on. To encourage the customer to leave a review, you could kindly ask them in the purchase receipt to rate your downloads, followed by a list of the downloads they purchased. Each download links right back to the product’s page on your website.

This tiny plugin adds a {downloads} email tag which you can then use for either the purchase receipt email or the admin notification email. Once activated, add the {downloads} email tag to your email templates from Downloads → Settings → Emails.

Download

Force a minimum password length at checkout

Learn how you can force a customer to enter a minimum password length at checkout in Easy Digital Downloads

Here’s how you can force a minimum password length when a customer creates an account on the checkout page in Easy Digital Downloads.

Copy and paste the following code below (mind the opening PHP tag) into your child theme’s functions.php or custom plugin:

Show the terms of agreement by default in Easy Digital Downloads

This code snippet for Easy Digital Downloads will make the terms of agreement at checkout already expanded by default so the customer does not have to click the link to expand it.

A customer on the Easy Digital Downloads‘ forums wanted to show the terms of agreement on the checkout page without the customer having to click to expand it. This is useful when you don’t have much text (as in the case of the customer) or perhaps you simply want to include a link to the terms of agreement on another page.

The Code

Copy and paste the following function (mind the opening PHP tag) into your child theme’s functions.php file or custom plugin: