• Resolved xentar

    (@xentar)


    Hey, ppl. I have a little issue. My client have a woocommerce website where we configured LiteSpeed, with server and all, but we are having issues with the stock update, that is not being updated (or purged the page cache that contain it). We have it configured with the aggresive preset, and more changes.
    The issue, i think, is that most of the sales are done via mail, so the orders are mostly created by hand. Could be that there is no hook to purge the cache of products of the order created this way and is more “on cart checkout” hook? If is the case, is there a snippet i can use to force purge the products of an order created by hand on save? or change status?

    Thanks in advance

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support qtwrk

    (@qtwrk)

    that seems to be an unique way of creating order it seems

    could you please explain a bit detail how exactly was the order placed ?

    Thread Starter xentar

    (@xentar)

    Probably my way to explain it was open for confusion, jeje
    I mean that most orders are made manually on the backend of woocommerce. So, they receive a request via mail, the shop-managers go to woocommerce>orders, create a new one, fill the products themselves, save the order, generate a pdf/html (if is a quote) and notify the client. The stock of the products is reduced when the sale is concreted.
    The site work this way because is some kind of hybrid commerce. They sell and do quotes, and most of the sales are request via mail or phone. Of course, is possible to buy or ask for quotes from front end, but there are a lot of old clients that prefear the direct contact.

    My guess is that the product page purge on stock change is not being updated because of this “backend” way of doing things.

    Plugin Support qtwrk

    (@qtwrk)

    hm ? please try check if any of stock related hook is fired upon your action

    for example woocommerce_updated_product_stock , or woocommerce_reduce_order_stock

    Thread Starter xentar

    (@xentar)

    Ok, I did the tests. These two days, i left a log with the hooks you proposed. Yes, they are triggered (if they are sales, if they are quotes, no [thank goodness or I have another problem hehe]) Looking at, i guess the issue is another then…
    What snipped i need to call for refresh/purge inside that hooks or individual producs/group? probably i’m going to need to use it in another hook provided by an external ERP

    Plugin Support qtwrk

    (@qtwrk)

    add_action( 'woocommerce_updated_product_stock', 'woo_lscwp_purge' );
    function woo_lscwp_purge( $product_id ) {
      if (defined('LSCWP_V')){
        do_action( 'litespeed_purge_post', $product_id );
      }
    }

    maybe something like this.

    Thread Starter xentar

    (@xentar)

    Thanks, going to give it a try. Need to contact someone who developed a sync with an ERP, i think there must be the issue… Let see if i can implement there.

    Plugin Support qtwrk

    (@qtwrk)

    aye , basically the idea behind is whenever you change a product status like stock , you should find a way to trigger do_action( 'litespeed_purge_post', $product_id ); accordingly to purge the cache.

    Thread Starter xentar

    (@xentar)

    Thanks a lot, qtwrk
    Talked with the dev from the erp sync we are using, and he going to update their module implementing the snipet you shared with me. Looks like the issue was on how it was updated the stock behind the curtain, no on orders per se.

    • This reply was modified 9 months, 2 weeks ago by xentar.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Woocommerce stock issue’ is closed to new replies.