Skip to content
This repository was archived by the owner on Feb 23, 2020. It is now read-only.

Commit 0250451

Browse files
deodadJeff Dutil
authored andcommitted
Add shipping_method code
In 2-4-stable a code field was used for shipping methods. Here is the intention: > The expectation, like a sku, is that a shipping_method.code could represent an immutable value that is safe to bind against when figuring > out what shipping method to use. Fixes #78
1 parent 49dff00 commit 0250451

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/serializers/spree/wombat/shipment_serializer.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Wombat
55
class ShipmentSerializer < ActiveModel::Serializer
66
attributes :id, :order_id, :email, :cost, :status, :stock_location,
77
:shipping_method, :tracking, :placed_on, :shipped_at, :totals,
8-
:updated_at, :channel, :items
8+
:updated_at, :channel, :items, :shipping_method_code
99

1010
has_one :bill_to, serializer: AddressSerializer, key: "billing_address"
1111
has_one :ship_to, serializer: AddressSerializer, key: "shipping_address"
@@ -41,6 +41,10 @@ def stock_location
4141
def shipping_method
4242
object.shipping_method.try(:name)
4343
end
44+
45+
def shipping_method_code
46+
object.shipping_method.try(:code)
47+
end
4448

4549
def placed_on
4650
if object.order.completed_at?

0 commit comments

Comments
 (0)