【问题标题】:Spree 2.1.0. How to avoid a shipment method choosing when creating an order大礼包 2.1.0。创建订单时如何避免选择发货方式
【发布时间】:2014-02-23 20:00:11
【问题描述】:

我不需要选择一种发货方式,因为它是唯一的一种。发货价格仍然取决于地址位置。创建订单时如何避免选择发货方式?

【问题讨论】:

    标签: ruby-on-rails-4 spree


    【解决方案1】:

    从文档(在此处找到:http://guides.spreecommerce.com/developer/checkout.html#modifying-the-checkout-flow),您可以像这样更改结帐流程:

    checkout_flow do
      go_to_state :payment
      go_to_state :complete
    end
    

    所以我认为你的代码应该是这样的:

    Spree::Order.checkout_flow do
      go_to_state :address
      #go_to_state :delivery <= I've commented this line.
      go_to_state :payment, if: ->(order) {
        order.update_totals
        order.payment_required?
      }
      go_to_state :confirm, if: ->(order) { order.confirmation_required? }
      go_to_state :complete
      remove_transition from: :delivery, to: :confirm
    end
    

    您可以在此处找到您正在覆盖的 checkout_flow:https://github.com/spree/spree/blob/2-1-stable/core/app/models/spree/order.rb#L8

    也许您可以像这样删除该步骤:

    Spree::Order.class_eval do
      remove_checkout_step :delivery
    end
    

    这应该会让你朝着正确的方向前进。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多