I think this question is probably more directed at the guys from Expresso Store, but maybe there's someone else out there that has had to deal with something similar before and can point me in a direction.

We are using CE Cache to cache certain parts of our templates, including product data. We've set up cache breaking for when a product channel entry gets added/updated, no problem here, but because the Sales section of Store is outside of the channel entries view, the caching does not get refreshed again after a sale has been associated to a specific product. It is not really a nice solution for us to tell our client they have to go and edit a product again after creating a sale to break the cache.

The ideal for us would be if there's a hook that gets triggered by Expresso Store when a new sale/discount is created that I can just extend to clear the cache programmatically. Also ideally I would not want to hack Store self. I have looked at the documentation here, but most of the hooks look like they are related to the ordering process.

Any ideas?

1 Answer 1


Just documenting this if someone else might run into the same issue. It turns out there isn't a hook in Expresso Store (yet) that will allow you to clear caching on updating/inserting of a sale/discount.

How I ended up resolving it was by adding a custom hook into the Sales Controller and Discounts Controller in the Store add-on self. I am not a big fan of hacking third party plugins, but it was the only solution I could come up with at this point.

The code is basically the same in the two controllers, so just search for the comment "// handle form submit" and update the code to something like this:

if ($this->ee->form_validation->run() === true) { $sale->save();

// Adding custom hook for when a sale gets updated, so we can clear cache
if ($this->ee->extensions->active_hook('custom_store_cp_sale_update')) {

$this->ee->session->set_flashdata('message_success', lang('store.settings.updated'));


This hook will then be called when a new sale or discount entry is created or when an existing one is edited.

Hope this can help someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.