User account menu

  • Log in
BXTra.net

Breadcrumb

  • Home
  • Drupal Commerce 2 - Create Simple Stock with ECA (Part 2)

Drupal Commerce 2 - Create Simple Stock with ECA (Part 2)

By BXTra | 2:31 AM PDT, Tue September 03, 2024

In the previous story "Drupal Commerce 2 - Create Simple Stock with Custom Module and ECA", I created simple stock using custom module together with ECA module.  Later, I found that I can use just ECA to check availability of the product.  It's quite easy.  Here is what I do:

  1. Start by create an integer field name field_eca_stock in Product Variation
  2. Create a new ECA model as below:
    1. Event "Build Form" -> Restricted by entity type id "commerce_order_item"
    2. Condition : "Compare Two Scalar Value" 
      1. First value : [entity:purchased_entity:entity:field_eca_stock]
      2. Comparation Operator : Less than
      3. Second value : 1
    3. Action : Form Field: Set as Disable
      1. Field name : submit
      2. Set as disabled : yes

That's it.  

 

Software :

  1. Drupal 10.3.2
  2. ECA: Event - Condition – Action module 2.0.4
About text formats
  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

  • Will the router get the Openvpn as a client option?
    6 years ago
  • cancellation
    6 years 1 month ago
  • Router ASUS RT-N12 D1 tomatoes passwort falsch
    7 years 8 months ago
  • WPS button = 30/30/30 hard reset button
    7 years 9 months ago
  • Save my day!
    8 years 3 months ago
  • How to
    8 years 6 months ago
  • Can i still access my modem (the one with the ISP provided)?
    8 years 6 months ago
  • A saving step!
    8 years 10 months ago
  • Problem with Asus n12e-c1
    9 years ago
  • don't use Hostgator
    9 years 2 months ago

© 2007 - 2023 BXTra.net. All Rights Reserved. 
Certain other content, photos and artwork displayed on BXTra.net are protected by copyright and are the property of their respective owners.

Privacy Policy