Add an availability checker which checks if the entity is accessible or not

Created on 17 October 2019, over 5 years ago
Updated 22 February 2024, about 1 year ago

Problem/Motivation

We currently have the AvailabilityManager API with no default implementation. Drupal Commerce out of the box provides products that can be published or not. We could add an availability manager which checks if the order item references an unpublished variation.

Proposed resolution

Add an availability checker that checks if the purchasable entity implements \Drupal\Core\Entity\EntityPublishedInterface. If it does, return the value of isPublished.

Remaining tasks

Consider notes in the following issues:

#3023417: Adding an item that would be denied by an availability_checker results in an order with a deleted order item

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Needs work

Version

2.0

Component

Other

Created by

🇺🇸United States mglaman WI, USA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇦Ukraine khiminrm

    Re-rolled the patch from #19 to the latest 2.x-dev, because it failed to apply on commerce_order.services.yml.

  • 🇩🇪Germany Anybody Porta Westfalica

    @jsacksick shouldn't this target 3.0.x then based on #34 and get finished to be merged into that before release? (Just read through the comments and you wrote "Well, this is a needed functionality IMO")

    I'll leave changing the target version to you.

  • Status changed to Postponed 23 days ago
  • 🇳🇴Norway zaporylie

    This is a valid addition. However, with 3.x already released, we missed the opportunity to introduce it in a new major version—especially since it might not be backward compatible. That said, this is actually a good thing. We should ideally avoid introducing backward-incompatible changes even between major versions, when possible.

    I believe this new checker can still be added, as long as it only affects new sites and existing sites retain their current behavior.

    To make it easier for our core audience—ambitious site builders—to enable or disable availability rules and checkers as needed, I’ve proposed Expose Availability Checkers in the Admin UI Active .

Production build 0.71.5 2024