Title: Andrew's Replies | WordPress.org

---

# Andrew

  [  ](https://wordpress.org/support/users/krandrew/)

 *   [Profile](https://wordpress.org/support/users/krandrew/)
 *   [Topics Started](https://wordpress.org/support/users/krandrew/topics/)
 *   [Replies Created](https://wordpress.org/support/users/krandrew/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/krandrew/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/krandrew/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/krandrew/engagements/)
 *   [Favorites](https://wordpress.org/support/users/krandrew/favorites/)

 Search replies:

## Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Stock Level Pricing] Price rules with stock level changes for variations in variable p. is not saving](https://wordpress.org/support/topic/price-rules-with-stock-level-changes-for-variations-in-variable-p-is-not-saving/)
 *  Plugin Author [Andrew](https://wordpress.org/support/users/krandrew/)
 * (@krandrew)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/price-rules-with-stock-level-changes-for-variations-in-variable-p-is-not-saving/#post-18262209)
 * Hi there,
 * Those values are handled by JavaScript. Could you please open the developer console
   in your browser, check if there are any JavaScript errors, and share them with
   us? This will help us identify the issue more efficiently.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Stock Level Pricing] Problem with configuration](https://wordpress.org/support/topic/problem-with-configuration-5/)
 *  Plugin Author [Andrew](https://wordpress.org/support/users/krandrew/)
 * (@krandrew)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/problem-with-configuration-5/#post-18201307)
 * Hi there,
 * The plugin is designed for cases where you want to change the price (offer discounts
   or increase prices) when a certain stock level is reached. To use this, you need
   to enable the ‘Stock Management’ feature. If you plan to sell items when stock
   levels fall below 0, you should also enable backorders – [https://prnt.sc/vaZADy-6GVhS](https://prnt.sc/vaZADy-6GVhS).
 * With Stock Level Pricing, you can set discounted prices for specific stock levels.
   For example, if the current stock is 2 or less, you can offer a 10% discount –
   [https://prnt.sc/93LVwEsKkZpZ](https://prnt.sc/93LVwEsKkZpZ)
 * In this case, the discounted price when there are 2 or 1 items left will be $
   90 – [https://prnt.sc/HTg9Iz2IveI5](https://prnt.sc/HTg9Iz2IveI5)
 * When the stock is 0, backorders will be sold at full price – [https://prnt.sc/dhIt1vHl-TD4](https://prnt.sc/dhIt1vHl-TD4)
 * Hope this helps!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Stock Level Pricing] Plugin customization](https://wordpress.org/support/topic/plugin-customization-34/)
 *  Plugin Author [Andrew](https://wordpress.org/support/users/krandrew/)
 * (@krandrew)
 * [2 years ago](https://wordpress.org/support/topic/plugin-customization-34/#post-17924119)
 * Hi Gerry,
 * I don’t think that any plugin is capable of handling your specific case, including
   Stock Level Pricing. It would be much easier to simply write a function that 
   will change the price for all products with a stock level of 0, rather than trying
   to adjust the Stock Level Pricing plugin, as this goes against the core logic
   of the plugin.
 * Here is a simple function that you can put inside your functions.php file to 
   recalculate the price of all products with a stock level of 0:
 *     ```wp-block-code
       // Add the function to adjust product price based on 0 stock levelfunction custom_adjust_price_based_on_stock($price, $product) {    // Get the regular price of the product    $regular_price = $product->get_regular_price();    // Get the stock quantity of the product    $stock_quantity = $product->get_stock_quantity();    // Check if the stock quantity is 0    if ($stock_quantity === 0) {        // Calculate the new price based on the given formula        $adjusted_price = $regular_price + 50 + ($regular_price * 0.35) + 20;        return $adjusted_price;    }    // If stock quantity is greater than 0, return the regular price    return $regular_price;}// Hook into WooCommerce to apply the custom price adjustmentadd_filter('woocommerce_product_get_price', 'custom_adjust_price_based_on_stock', 10, 2);add_filter('woocommerce_product_variation_get_price', 'custom_adjust_price_based_on_stock', 10, 2);// Ensure the custom price adjustment is applied to product variations as welladd_filter('woocommerce_variation_prices_price', 'custom_adjust_price_based_on_stock', 10, 2);add_filter('woocommerce_variation_prices_regular_price', 'custom_adjust_price_based_on_stock', 10, 2);
       ```
   
 * Of course, it’s pretty basic, but it does the job. It would get a bit more complicated
   if you want to consider the sale price as well, or make it compatible with other
   plugins that may adjust the price (other than simply retrieving the regular price
   and making calculations).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Stock Level Pricing] Shortcode?](https://wordpress.org/support/topic/shortcode-985/)
 *  Plugin Author [Andrew](https://wordpress.org/support/users/krandrew/)
 * (@krandrew)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/shortcode-985/#post-17535847)
 * Hello there,
 * The plugin currently doesn’t offer a dedicated block or shortcode for standalone
   use in Elementor. Nevertheless, the stock level table is integrated into the 
   product_summary, so it will be displayed whenever you include the ‘single product
   page’ ([https://prnt.sc/oczKdV-lKMZE](https://prnt.sc/oczKdV-lKMZE)) element 
   or use the ‘add-to-cart-button’ widget in Elementor. If you use any other widgets
   that render the product_summary (which typically includes the price, quantity,
   add-to-cart option, and stock information), the stock-level-pricing details will
   be automatically included as part of this display.
 * If you encounter any issues or have further questions, feel free to reach out.

Viewing 4 replies - 1 through 4 (of 4 total)