Product is no longer available for registration

Created on 4 January 2025, 4 months ago

Hi, I tried to configure this module on my webform, but I get also the same error:

- access denied instead of forwarding to the checkout pages
- and "product is no longer available for registration". It has been removed from the cart.

I think I did something wrong in my configuration, but I don't know what?

💬 Support request
Status

Active

Version

3.0

Component

Documentation

Created by

🇧🇪Belgium vyaenes Nazareth-De Pinte

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

Comments & Activities

  • Issue created by @vyaenes
  • 🇧🇪Belgium vyaenes Nazareth-De Pinte
  • 🇧🇪Belgium vyaenes Nazareth-De Pinte
  • 🇭🇺Hungary nagy.balint

    Hi!

    Did you follow the video for setup? https://www.youtube.com/watch?v=zf1ZGKZVGQQ

  • 🇧🇪Belgium vyaenes Nazareth-De Pinte

    Hi, I just watched the video again, and yes, everything is like in the video.

  • 🇭🇺Hungary nagy.balint

    Which commerce modules do you have setup on your site?

    It seems weird that you get the "no longer available for registration" message, maybe there is a commerce module which alters the process and collides with this module?

    I guess there is no easy way for me to look around on the site to see the configuration.

  • 🇧🇪Belgium vyaenes Nazareth-De Pinte

    - I'll sent you a private message with some details. -

    I just created a normal test product, and there I got a normal checkout flow. And that's working.

    But with the webform, I do get always get that error...
    I tried already to create a normal commerce product or purchasable entity that has te same id as the value in my form. Maybe that should working? But not...

  • 🇭🇺Hungary nagy.balint

    The commerce registration module has the code

    if ($variation = $item->getPurchasedEntity()) {
    ...
    }
          else {
            $remove_item = TRUE;
            $message = $this->t('Sorry, <strong>@item_name</strong> is no longer available for registration. It has been removed from your cart.', [
              '@item_name' => $item->getTitle(),
            ]);
          }

    since we have no $item->getPurchasedEntity(), it will remove the item.

    We will need to check if we can set this when creating the order, even though in our case multiple order item could have the same entity (submission or webform?)

  • 🇭🇺Hungary nagy.balint

    Of course the purchasable entity is optional in Commerce, so it is most likely that the modules that use it without checking hasPurchasedEntity are actually using Commerce incorrectly, and it is not technically a bug in this module.

    But if we would like to have a purchasable entity, we have the following options:
    1, We can create an actual entity for each orderItem.
    2, We can extend the OrderItem class and also define a dummy purchasable entity class, and then override the getPurchasedEntity method to return the dummy object. That way we don't have to save in database an extra entity for each OrderItem.

Production build 0.71.5 2024