Deselect other pricing options when last option is checked

This tutorial will show you how you can automatically deselect all the other pricing options when the very last option is checked.

With Easy Digital Downloads you can enable the multi-option purchase mode (shown below) which will allow the customer to select and add more than one pricing option to their cart. This tutorial will show you how you can automatically deselect all the other pricing options when the very last option is checked.

Imagine that you are selling an MP3 album with Easy Digital Downloads. You allow the customer to purchase each song individually, with the last pricing option being the full album. It would be nice (and convenient) to deselect all the other pricing options, if the customer had chosen a few songs, but then decided to purchase the full album. There’s no real point in the customer purchasing the same song twice.

Multi-option purchase mode enabled
Multi-option purchase mode enabled
The standard behaviour of multi-check pricing options
The standard behaviour of multi-check pricing options
Checking the last pricing option now deselects the others
Checking the last pricing option now deselects the others

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

Leave a Reply

Your email address will not be published. Required fields are marked *