Enable use with Drupal 10

Created on 14 September 2023, about 1 year ago
Updated 9 January 2024, 11 months ago

Problem/Motivation

Module does not work with D10

Steps to reproduce

* Install Drupal 10
* Try and install Commerce Cart Advanced

Proposed resolution

Add ^10 to core_version_requirement

Remaining tasks

User interface changes

API changes

Data model changes

šŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

šŸ‡¬šŸ‡§United Kingdom jofitz

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

Merge Requests

Comments & Activities

  • Issue created by @jofitz
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • šŸ‡¬šŸ‡§United Kingdom jofitz

    Create patch

  • šŸ‡µšŸ‡ŖPeru krystalcode

    Thanks for the patch.

    I will not merge this until it is actually tested and found to work with Drupal 10, I do not want to mark it as Drupal 10-compatible if it actually still has incompatibilities. To install on Drupal 10 and test it, create a fork and install the forked version via composer.

    I do not right now have an application that has already upgraded to Drupal 10 that uses this module so it may take me a while until I test it myself. Let us know how it works for you.

  • Status changed to Needs work about 1 year ago
  • šŸ‡ŗšŸ‡øUnited States michelle Wisconsin, USA

    I attempted to port this for a client but ran into issues and haven't gotten it working, yet. This is what Upgrade Status reports is needed:

    Commerce Cart Advanced
    Scanned on Sun, 09/03/2023 - 18:36.
    
    1 error found. 3 warnings found. Avoid some manual work by using drupal-rector
    for fixing issues automatically or Upgrade Rector to generate patches.
    
    web/modules/contrib/commerce_cart_advanced/src/Event/CartsSplitEvent.php:
    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
    ā”‚  STATUS  ā”‚ LINE ā”‚                           MESSAGE                           ā”‚
    ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
    ā”‚ Check    ā”‚ 12   ā”‚ Class Drupal\commerce_cart_advanced\Event\CartsSplitEvent   ā”‚
    ā”‚ manually ā”‚      ā”‚ extends deprecated class                                    ā”‚
    ā”‚          ā”‚      ā”‚ Symfony\Component\EventDispatcher\Event: since Symfony 4.3, ā”‚
    ā”‚          ā”‚      ā”‚ use "Symfony\Contracts\EventDispatcher\Event" instead       ā”‚
    ā”‚          ā”‚      ā”‚                                                             ā”‚
    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
    
    web/modules/contrib/commerce_cart_advanced/src/Hook/CartItemFormAlter.php:
    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
    ā”‚  STATUS  ā”‚ LINE ā”‚                           MESSAGE                            ā”‚
    ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
    ā”‚ Check    ā”‚ 77   ā”‚ Parameter $number_formatter_factory of method                ā”‚
    ā”‚ manually ā”‚      ā”‚ Drupal\commerce_cart_advanced\Hook\CartItemFormAlter::__cons ā”‚
    ā”‚          ā”‚      ā”‚ truct() has typehint with deprecated interface               ā”‚
    ā”‚          ā”‚      ā”‚ Drupal\commerce_price\NumberFormatterFactoryInterface:       ā”‚
    ā”‚          ā”‚      ā”‚ Replaced by CurrencyFormatterInterface.                      ā”‚
    ā”‚          ā”‚      ā”‚                                                              ā”‚
    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
    
    web/modules/contrib/commerce_cart_advanced/src/Plugin/Block/CurrentCartBlock.php:
    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
    ā”‚  STATUS  ā”‚ LINE ā”‚                           MESSAGE                            ā”‚
    ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
    ā”‚ Fix with ā”‚ 67   ā”‚ Call to deprecated function drupal_get_path(). Deprecated in ā”‚
    ā”‚ rector   ā”‚      ā”‚ drupal:9.3.0 and is removed from drupal:10.0.0. Use          ā”‚
    ā”‚          ā”‚      ā”‚ Drupal\Core\Extension\ExtensionPathResolver::getPath()       ā”‚
    ā”‚          ā”‚      ā”‚ instead.                                                     ā”‚
    ā”‚          ā”‚      ā”‚                                                              ā”‚
    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
    
    web/modules/contrib/commerce_cart_advanced/commerce_cart_advanced.info.yml:
    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
    ā”‚  STATUS  ā”‚ LINE ā”‚                          MESSAGE                           ā”‚
    ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
    ā”‚ Check    ā”‚ 0    ā”‚ Value of core_version_requirement: ^8.7.7 || ^9 is not     ā”‚
    ā”‚ manually ā”‚      ā”‚ compatible with the next major version of Drupal core. See ā”‚
    ā”‚          ā”‚      ā”‚ https://drupal.org/node/3070687.                           ā”‚
    ā”‚          ā”‚      ā”‚                                                            ā”‚
    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
  • šŸ‡ŖšŸ‡ØEcuador alexis_mc

    Here I leave an updated patch.

  • Status changed to Needs review about 1 year ago
  • šŸ‡ŗšŸ‡øUnited States DamienMcKenna NH, USA
  • Status changed to Needs work about 1 year ago
  • šŸ‡µšŸ‡ŖPeru krystalcode

    @alexis_mc Before I test this further myself, can you confirm whether you actually tested your patch on a working website? Or is it automatically generated patch?

    -    $this->eventDispatcher->dispatch(CartEvents::CARTS_SPLIT, $event);
    +    $this->eventDispatcher->dispatch($event, CartEvents::CARTS_SPLIT);
    -use Symfony\Component\EventDispatcher\Event;
    +use Symfony\Contracts\EventDispatcher\Event;
    

    This means dropping Drupal 8 support, which is fine at this point. The composer/info files need to be updated accordingly. I will create a new branch 1.x for Drupal 9/10 which will be the main branch moving forward, and keep the current 8.x-1.x in a deprecated case for the rare sites that still use Drupal 8.

    +        '#uri' => \Drupal::service('extension.list.module')->getPath('commerce') . '/icons/ffffff/cart.png',
    

    We'll need to inject this as a service in the constructor.

  • Status changed to Needs review 12 months ago
  • šŸ‡®šŸ‡³India keshavv India

    Thank you alexis_mc
    Your #5 patch fixed almost all issues. But I found a few more.
    Rerolled patch with more changes. It works for me.

  • šŸ‡®šŸ‡³India keshavv India
  • Status changed to RTBC 11 months ago
  • šŸ‡®šŸ‡³India keshavv India

    Confirmed that the patch added in #9 works perfectly.
    Thank you.

  • Merge request !9Issue #3387284 Drupal 10 compatibility ā†’ (Merged) created by krystalcode
  • Status changed to Fixed 11 months ago
  • šŸ‡µšŸ‡ŖPeru krystalcode
    • New branch 2.x that is compatible Drupal 9.3+/10.0+ and Commerce 2.33+. Commerce 2.33 is the first release that is really compatible with Drupal 10, so we have to set that as minimum version requirement.
    • The Save for Later functionality does not seem to work, and it might be a Drupal 10 incompatibility. We have a separate issue for this ( šŸ› Error when "Save for later" is clicked Active ) and will resolve this there, but I will not make a release before that is resolved. Until then, applications that do not make use of the Save for Later functionality can use the 2.x development branch.
    • Compared to the last patch, I removed the return type declarations; When we move to PHP 8 i.e. Drupal 10 as minimum version requirement, we'll update all code to use PHP 8 features and use strict types wherever possible.
    • Compared to the last patch, I removed the change to use the currency formatter. This is still a deprecation until Commerce 3.0, and I want to review this a bit more. I'll create a new issue for it.
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024