• Resolved logicinn

    (@logicinn)


    Hi there, I am testing this plugin on one of my demo sites. I exported all my products via the WordPress export products to csv functionality. I included metadata when I exported and saw that the columns for locations stock and price are now visible. I updated those columns and imported it and it worked perfectly. However, upon testing the stock doesn’t reduce when I generate orders for it. How do I get that to work? I did follow your guidance from a tutorial video and:

    1. toggled developers tab on
    2. Clicked crons tab and in a new tab pasted https://weboption4.logicinnovations.co.za/?slw-crons&action=update-stock&limit=10&reconsider=minute
    3. toggle the button in developers tab off (although upon testing the above url still works when the button is set as off?)
    4. Created a new order which was set to “processing” manually. I have the following settings ticked and unticked:
      • Restore location stock value for?cancelled?order status?<small>(Optional)</small>?– ticked
      • Restore location stock value for?failed?order status?<small>(Optional)</small>?– ticked
      • Restore location stock value for?pending?order status?<small>(Optional)</small> – unticked
    5. stock is not reducing and updating against orders received

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Fahad Mahmood

    (@fahadmahmood)

    Your cron interval isn’t good, every other minute it will consider the same set of products because everytime only 10 items are being updated. Please read the cron section carefully, how many products do you have in total?

    Thread Starter logicinn

    (@logicinn)

    Oh, okay. I only have 12 on my testing site but the client I want to recommend this to has approximately 200 products.

    Thread Starter logicinn

    (@logicinn)

    I’m still struggling. I changed the cron interval to https://weboption4.logicinnovations.co.za/?slw-crons&action=update-stock&limit=100&reconsider=second

    but it still doesn’t update the stock. Should I open a new thread as I see this is set as resolved but I still experience the problem?

    • This reply was modified 1 year, 6 months ago by logicinn.
    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    I try to explain the cron setup with an example here:

    For example I have 3000 live products including variations so what should be the cron settings?

    If I want to update all 3000 products every hour?
    I need to divide it among 60 minutes, so if I run a cron job every minute, I have 60 rounds. So every minute I need to update
    3000/60 = 50 products, so the cron command will be as follows:

    https://weboption4.logicinnovations.co.za/?slw-crons&action=update-stock&limit=50&reconsider=hour

    Did you notice something? Reconsider parameter is “hour”, which means, do not consider the same product before next hour.

    Ok, if I want to set an interval of 5 minutes, so actually I have only 12 rounds of cron job. So I need to choose 3000 products among 12 rounds of cron job.

    3000 / 12 = 250 products

    so the limit parameter will be 250 and reconsider parameter will stay “hour”, but you are going to set the interval value of your cpanel/hosting cron job settings to “5”. So every fifth minute you are update 250 products and not reconsidering the same product before the next hour, that’s why reconsider parameter is set to “hour”.

    Thread Starter logicinn

    (@logicinn)

    Thanks for the explanation. This makes sense, however it seems very complicated. Ideally I would just like to use a plugin that automatically updates in the background as soon as an order is placed which means that stock quantity will always be live and correct. This current structure just seems like there is margin for error. My client’s stock quantities isn’t that high and what if she, for instance, runs a special and people visit the site simultaneously? The chance is there that she might run out of stock but the site displays that she still has stock.

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    See, plugin is still evolving, whatever the solution is available today, will be in a better shape tomorrow. Things were not like this before, it has been improved a lot already.

    Thread Starter logicinn

    (@logicinn)

    I do understand that! This is a great initiative from your side. I’ll be keeping my eye on it. Thanks for your prompt assistance.

    Dear Fahad, thank you for your explanation. I think I understand how it works but not how to implement. From the explanation, I understand that I have to enter the url in a browser to run the event each time I want to update the WC stock? I thought I had to enter a new CRON event in a WC plugin ‘Cron events’. It asks for ‘Event type’ (standard cron event or PHP cron event), Hook name (?), Arguments (is optional and should be a JSON array?), next execution (now, tomorrow, date/time?) and repetition (every hour, etc.). I don’t see how I have to enter the information from the URL you showed in this form to configure the Cron event. In other words, how do I add the Cron event one time for always?

    Also, the number of products will change over time. Can I set a high number of products or do I need to specify the exact number – with regard to performance and load?

    Thanks for considering this question.

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    See, cron job script is designed to handle large number of products too. You just need to calculate the reconsider number as per your requirement. Hourly update is recommend, but it doesn’t meant that cron job will run after one hour, it means, same product will not be considered before 60 minutes again. Please watch the video tutorial given under the cron job tab with an example.

    Hello Fahad, thank you for your answer. Stock locations deducts items from the default stock location for orders via the WooCommerce shop. When I enter an order in the back office – for instance for a business client that calls or emails me to make an order – than the stock isn’t adjusted.

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    I have completed the investigation about this issue and confirming here with the settings I experienced the correct results.

    Edit stock location page settings for each of the stock location:

    Default for new products: Yes
    Auto order allocate: Yes
    Location priority: 1

    And when I tried ordering from one location, it correctly deducts the stock from that selected location and if I ordered from the other stock location, it deducts correctly from the other selected store. So there is no bug but maybe the difference of settings. Please try the settings as I mentioned above or come back with your findings.

    izmyyr

    (@izmyyr)

    Hello Fahad!
    I have a shop with around 30000 products.
    Im having some trouble using cron, to update if after every stock update import.
    ive used the ones that are proided in the plugin and tested with this : ?slw-crons&action=update-stock&limit=50&reconsider=minute

    But it just stops updating and doesnt continue.
    What am i doing wrong or what can i try?

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    You should never reconsider it every minute, because reconsider means, come to the initial point again. So you need to set it to day at least. If you are still facing this issue, let me know, I will help you to calculate the limit for cron job.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Stock not reducing when orders received’ is closed to new replies.