Sha256: a164a9d8d922e2a5dcfe04dd85726076e74741890aecfd3f55e7c55dd5e5e43b
Contents?: true
Size: 565 Bytes
Versions: 4
Compression:
Stored size: 565 Bytes
Contents
# frozen_string_literal: true module SolidusProductAssembly module Spree module Stock module InventoryValidatorDecorator def validate(line_item) total_quantity = line_item.quantity_by_variant.values.sum if line_item.inventory_units.count != total_quantity line_item.errors[:inventory] << I18n.t( 'spree.inventory_not_available', item: line_item.variant.name ) end end ::Spree::Stock::InventoryValidator.prepend self end end end end
Version data entries
4 entries across 4 versions & 1 rubygems