Spree deletes billing address

How do I delete my billing (or delivery) address in Spree verification mode? I am using spree 1.3

+4
source share
2 answers

You can remove the delivery address by removing the delivery step from the checkout_flow definition by placing this code in your application in app/models/spree/order_decorator.rb :

 Spree::Order.class_eval do checkout_flow do go_to_state :address go_to_state :payment, :if => lambda { |order| order.payment_required? } go_to_state :confirm, :if => lambda { |order| order.confirmation_required? } go_to_state :complete remove_transition :from => :delivery, :to => :confirm end end 

Without a delivery step, Spree will not request a delivery address or delivery information for an order.

+7
source

I have an alternative for this if you are using spree-core

Your view / spree / checkout / edit file has a render statement that includes error_messages.html.erb = render: partial => 'spree / shared / error_messages' ,: locals => {: target => @order}

So now you need to remove the name "ship" from _error_messages.html.erb, then it will not show such an error.

Make the following few changes to the spree / shared / _error_message file:

-target.errors.full_messages.each do | msg |
-unless (msg.include? ("Ship")) = nbsp; = msg

Remember, make changes to the error counter using the loop here. I am not currently using it, so I made a comment

// = t (: errors_prohibited_this_record_from_being_saved ,: count => target.errors.count)


I also made a comment on the same issue about github and stackoverflow- https://github.com/spree/spree/issues/2571#issuecomment-13769093

https://stackoverflow.com/questions/14891781/how-to-remove-the-shipping-address-validation-in-spree-checkout-process/14957973#comment20997203_14957973

0
source

Source: https://habr.com/ru/post/1441115/


All Articles