Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

reload instead of touch on emitting variant.backorderable.

Sebastian Palma0545d4e4b035
diff --git a/api/app/models/spree/api/webhooks/stock_item_decorator.rb b/api/app/models/spree/api/webhooks/stock_item_decorator.rb
index e957eeddd7..9732726a3c 100644
--- a/api/app/models/spree/api/webhooks/stock_item_decorator.rb
+++ b/api/app/models/spree/api/webhooks/stock_item_decorator.rb
@@ -12,8 +12,8 @@ module Spree
was_out_of_stock = !variant.in_stock_or_backorderable?
was_not_backorderable = !variant_backorderable?
yield
- touch # changes must be reflected before instantiating the serializer
if was_out_of_stock && was_not_backorderable && variant_backorderable?
+ reload
variant.queue_webhooks_requests!('variant.backorderable')
end
end