This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// place the code in the child theme functions.php or a custom code snippets plugin, like FluentSnippets | |
// What do this code | |
// What this Call hook does is to extract the product identifier from the field that is filled, | |
// and the order quantity from the quantity field. It checks when the form is submitted | |
// if there is enough of the product in stock, if so, it subtracts the quantity when the form is submitted. | |
// If there is not enough, an error is generated and the stock of the product is not changed. | |
// This code does not require the JFB Add to cart add-on. The hook does not go through the checkout process, | |
// it only adjusts the stock of the product based on the quantity of the order the user has submitted. |