Resolving Error “Only one donation form per page allowed”

Issue: When using the Donation Platform for WooCommerce plugin, you may encounter an error message stating “Only one donation form per page allowed.” This error occurs when there are multiple instances of donation forms present on a single page.

Explanation: Donation Platform for WooCommerce restricts the usage to only one donation form per page. Even if a donation form is not visible to the user, it still counts towards this limitation. The rationale behind this limitation lies in the way WooCommerce and other plugins handle checkouts. Multiple checkouts on a single page can potentially lead to conflicts and unexpected behavior.

Recommended Solution: Only add a single donation form per page. See https://wcdp.jonh.eu/documentation/advanced/multiple-donation-forms-on-one-page/

Alternative Solution: While it’s generally not recommended to add multiple donation forms on a single page as it might not function as expected, you can still proceed by applying a filter. This filter allows users to bypass the default behavior and include multiple donation forms on one page, albeit with potential limitations in functionality.

add_filter( 'wcdp_only_one_form_allowed', '__return_false' );

Implementation: To implement the filter, follow these steps:

  1. Install and activate the Code Snippets plugin (or any other plugin that allows adding custom PHP code or add it to functions.php directly).
  2. Navigate to the “Snippets” section in your WordPress dashboard.
  3. Click on “Add New” to create a new code snippet.
  4. Copy and paste the following code into the snippet editor:
add_filter( 'wcdp_only_one_form_allowed', '__return_false' );
  1. Give your snippet a title (e.g., “Allow Multiple Donation Forms”) for easy reference.
  2. Save the snippet.

Once the snippet is saved and active, the restriction on having only one donation form per page will be lifted, and users can include multiple donation forms as needed. However, exercise caution and ensure that adding multiple forms doesn’t adversely affect the functionality or user experience of your WooCommerce setup.

By following these steps, you can effectively resolve the error and customize the behavior of the Donation Platform for WooCommerce plugin to suit your specific needs. Note: While adding a filter is an option, it’s not recommended due to potential complications.