• Resolved ahmetbolu

    (@ahmetbolu)


    I am using your wonderful plugin in my project.
    I want to use this form not only for sold out products but also for Stock quantity 1.
    Is there a convenience method I can do this?
    This flexibility can be useful for many other people.
    In other words, this form can be active when my products fall to stock quantity 1.
    Thank you in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support CodeWooGeek Support

    (@codewoogeeksupport)

    Hello there,

    Good Day!!

    Thank you for your kind words and for using our plugin!

    We’ve added a dynamic class wrapper in the latest version (5.5.1) of our plugin. If your product is “in stock” with a specific quantity (for example, 2), the wrapper class will be cwginstock-2instock. You can leverage this class to display or hide the subscribe form using custom CSS.

    Please update to our latest version (5.5.1) and try the following PHP and CSS snippets along with it:

    1. Custom PHP Snippet:

    You can extend the allowed statuses to include instock using the following:

    add_filter('cwg_default_allowed_status', 'cwg_extend_stock_status');
    function cwg_extend_stock_status($stock_statuses, $product, $variation) {
    $stock_statuses = array_merge($stock_statuses, array('instock'));
    return $stock_statuses;
    }

    2. Custom CSS Snippet:

    To control the visibility of the subscription form for products with a stock quantity of 1, you can use this

      section.cwginstock-subscribe-form {
      display: none;
      }

      section.cwginstock-outofstock, section.cwginstock-1instock {
      display: block !important;
      }

      Please note that the CSS code above has not been tested and may work differently with different themes.

      Thanks.

      Thread Starter ahmetbolu

      (@ahmetbolu)

      Thank you for your valuable feedback. I did the operations as in the instructions, but my website gives critical error in the relevant products. Is it possible to provide information by checking the code? Or is there a safer method?
      I am using the latest version of the plugin.

      Thank you very much.

      Plugin Support CodeWooGeek Support

      (@codewoogeeksupport)

      Hello there,

      We’re not entirely sure what’s causing the critical error. Could you please check the fatal error log from a recent date and share the screenshots of it? This will help us identify the issue.

      To do this, go to your Admin Dashboard, then navigate to WooCommerce -> Status -> Logs. Look for logs with the prefixes “fatal-errors” and “back-in-stock-notifier-for-woocommerce” dated recently.

      Thanks.

      Plugin Author CodeWooGeek

      (@codewoogeek)

      Hello there,

      We haven’t received a response from you in a while, so we are marking this as resolved. If you have any further questions, please feel free to start a new thread.

      Closing this now. Have a great day!

      Thanks.

    Viewing 4 replies - 1 through 4 (of 4 total)
    • You must be logged in to reply to this topic.