Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Commit 19fdd62

Browse files
damianlegawiecgitbook-bot
authored andcommitted
GitBook: [master] one page modified
1 parent 95c83a3 commit 19fdd62

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

internals/shipments.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,16 +446,20 @@ For an example of a simple splitter, take a look at Spree's [weight based splitt
446446
After creating your splitter, you need to add it to the array of splitters Spree uses. To do this, add the following to your application's spree initializer `spree.rb` file:
447447

448448
```ruby
449-
Rails.application.config.spree.stock_splitters << Spree::Stock::Splitter::CustomSplitter
449+
Rails.application.config.after_initialize do
450+
Rails.application.config.spree.stock_splitters << Spree::Stock::Splitter::CustomSplitter
451+
end
450452
```
451453

452454
You can also completely override the splitters used in Spree, rearrange them, etc. To do this, add the following to your `spree.rb` file:
453455

454456
```ruby
455-
Rails.application.config.spree.stock_splitters = [
456-
Spree::Stock::Splitter::CustomSplitter,
457-
Spree::Stock::Splitter::ShippingCategory
458-
]
457+
Rails.application.config.after_initialize do
458+
Rails.application.config.spree.stock_splitters = [
459+
Spree::Stock::Splitter::CustomSplitter,
460+
Spree::Stock::Splitter::ShippingCategory
461+
]
462+
end
459463
```
460464

461465
Or if you don't want to split packages just set the option above to an empty array. e.g. a store with the following configuration in spree.rb won't have any package splitted.

0 commit comments

Comments
 (0)