- Issue created by @introfini
- @introfini opened merge request.
- 🇵🇹Portugal introfini
introfini → changed the visibility of the branch cherry-pick-84c6a86a to hidden.
- 🇵🇹Portugal introfini
introfini → changed the visibility of the branch 8.x-1.x to hidden.
- Status changed to Needs review
5 months ago 2:11pm 27 July 2024 - 🇵🇹Portugal introfini
The merge request (MR) introduces this functionality.
To configure the desired message, follow these steps:
- Navigate to /admin/commerce/config/stock/enforcement/settings.
- Set the desired message for out-of-stock notifications.
With these settings updated, each product variation will now display an indication if it is out of stock.
- 🇹🇷Turkey Umit Turkey
Something like this is definitely needed. Otherwise, it will be too troublesome for the end user, and a CSS class should be added for styling in sites that use processed attributes.
+1
- 🇨🇦Canada trevorkjorlien
Needing this functionality myself. I ran the branch and can fill out and save the new form field.
But when I load up a product page, the
{{product.variations}}
field doesn't appear, which loads the add to cart form. I also get this error:The website encountered an unexpected error. Please try again later. TypeError: Drupal\Core\Render\Element::children(): Argument #1 ($elements) must be of type array, null given, called in /Users/trevorkjorlien/Documents/Plateau Astro/Web/pa-drupal-2019/web/modules/contrib/commerce_stock/modules/enforcement/commerce_stock_enforcement.module on line 489 in Drupal\Core\Render\Element::children() (line 72 of core/lib/Drupal/Core/Render/Element.php). Drupal\Core\Render\Element::children(NULL) (Line: 489) commerce_stock_enforcement_form_commerce_order_item_add_to_cart_form_alter(Array, Object, 'commerce_order_item_add_to_cart_form_commerce_product_20') (Line: 562) Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'commerce_order_item_add_to_cart_form_commerce_product_20') (Line: 840) Drupal\Core\Form\FormBuilder->prepareForm('commerce_order_item_add_to_cart_form_commerce_product_20', Array, Object) (Line: 284) Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 97) Drupal\commerce_product\ProductLazyBuilders->addToCartForm('20', 'full', 1, 'en') call_user_func_array(Array, Array) (Line: 101) Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #lazy_builder callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788) Drupal\Core\Render\Renderer->doCallback('#lazy_builder', Array, Array) (Line: 353) Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204) Drupal\Core\Render\Renderer->render(Array, 1) (Line: 160) Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 580) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 159) Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 175) Drupal\Core\Render\Renderer->renderPlaceholder('callback=commerce_product.lazy_builders%3AaddToCartForm&args%5B0%5D=20&args%5B1%5D=full&args%5B2%5D=1&args%5B3%5D=en&token=FT-D0BG4z9OAbw_Xou5fuAUgPUogXOigYpvmDRhFbjc', Array) (Line: 693) Drupal\big_pipe\Render\BigPipe->renderPlaceholder('callback=commerce_product.lazy_builders%3AaddToCartForm&args%5B0%5D=20&args%5B1%5D=full&args%5B2%5D=1&args%5B3%5D=en&token=FT-D0BG4z9OAbw_Xou5fuAUgPUogXOigYpvmDRhFbjc', Array) (Line: 547) Drupal\big_pipe\Render\BigPipe->sendPlaceholders(Array, Array, Object) (Line: 305) Drupal\big_pipe\Render\BigPipe->sendContent(Object) (Line: 112) Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 381) Symfony\Component\HttpFoundation\Response->send() (Line: 20)