Support Commerce 3.x

Created on 26 January 2025, 2 months ago

Problem/Motivation

Currently, both in the latest published release and in the module description, it is specified that this module is compatible with Drupal 11. However, in the composer.json file, the dependency is set to drupal/commerce:^2.0, and as of today, Commerce 2.x is not compatible with Drupal 11; only Commerce 3.x is. Therefore, since this module is entirely dependent on Commerce, it is impossible for this module to support Drupal 11 without installing Commerce 3.x.

On the other hand, after installing Commerce 3.x and trying to make a payment using both the UnzerOnSite and UnzerOffSite payment gateways, the website returns the following error, which makes this module completely useless in Commerce 3.x:

Error: Call to a member function getPluginId() on null in Drupal\commerce_payment\PaymentStorage->doCreate() (line 50 of modules/contrib/commerce/modules/payment/src/PaymentStorage.php).

Steps to reproduce

  1. Assuming your website is already up and running with Commerce, upgrade to Commerce 3.x. You will not be able to upgrade to Commerce 3.x if you are using Commerce Unzer 1.0.0-alpha5, as this version requires drupal/commerce:^2.0 as mentioned above, so you will need to temporarily remove this module from your composer in order to upgrade to Commerce 3.x
  2. Once done, install Commerce Unzer using the source files from the project. Use the git instructions provided in the Version control tab.
  3. Make sure you have a payment gateway that uses UnzerOnSite and another that uses UnzerOffSite.
  4. On your form, make a credit card donation using one of the payment gateways created and based on Unzer.
  5. At this point you should have already had the error mentioned above.

Proposed resolution

The proposed solution is in the Merge request that has been created and is based on the following Change record: https://www.drupal.org/node/3468511 → . In addition, to avoid backward compatibility issues, it might be a good idea to create a new major release that supports Commerce 3.x while the 1.x branch continues to support Commerce 2.x

Remaining tasks

  • Check that the proposed solution works correctly. I have tested it in a real project and the proposed solution works correctly, but considering that we do not have tests in this module, a double check is appreciated.
  • Decide whether you want to create a new major release, something like 2.0.0-alpha1 or whatever the maintainers consider appropriate.

Last but not least, the solution to this compatibility issue is something I have personally checked with @lluvigne, please give him credit too. Thanks!

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain dimaro Seville, Spain

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024