Sha256: edcc00b836922ef98b699aa9793926d640b6317f82d9092fcae6ac5382bef9d4

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

module Workarea
  decorate Storefront::CartViewModel, with: :flow_io do
    def subtotal_price
      return super unless model.experience.present?

      model.flow_subtotal_price
    end

    def total_price
      return super unless model.experience.present?

      model.flow_total_price
    end

    def total_adjustments
      return super unless model.experience.present?

      @total_adjustments ||= flow_price_adjustments.reduce_by_description('order')
    end

    # TODO base bug, product isn't passing options into product view models
    def recommendations
      return [] unless model.quantity > 0
      @recommendations ||= Storefront::CartRecommendationsViewModel.new(model, options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 app/view_models/workarea/storefront/cart_view_model.decorator