Refresh variant cache when changing stock movements

This commit is contained in:
Kristina Lim
2019-08-18 16:22:12 +08:00
parent 3ecb5c0c75
commit 706168f2f0

View File

@@ -0,0 +1,10 @@
Spree::StockMovement.class_eval do
after_save :refresh_products_cache
private
def refresh_products_cache
return if stock_item.variant.blank?
OpenFoodNetwork::ProductsCache.variant_changed stock_item.variant
end
end