Skip to content

Commit

Permalink
fix: Hydrate props properly
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Dec 9, 2021
1 parent 78a48bc commit 89049cd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/GiftCardOrCouponCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ const GiftCardOrCouponCode: FunctionComponent<GiftCardOrCouponCodeProps> = ({
...props
}) => {
const { order } = useContext(OrderContext)
let codeType = type && (`${type}Code` as OrderCodeType)
if (!type && order && has(order, 'couponCode') && !isEmpty(order.coupon_code))
let codeType = type && (`${type}_code` as OrderCodeType)
if (
!type &&
order &&
has(order, 'coupon_code') &&
!isEmpty(order.coupon_code)
)
codeType = 'coupon_code'
else if (!type) codeType = 'gift_card_code'
const code = order && codeType ? order[codeType] : ''
Expand Down

0 comments on commit 89049cd

Please sign in to comment.