Comments (3)
I try comment code relate to address. No button showing, only image and link popup 'What 's paypal?'
app/views/spree/shared/braintree_vzero/_paypal.js
enableShippingAddress: false,
// shippingAddressOverride: {
// recipientName: '<%# "#{shipping_address.firstname} #{shipping_address.lastname}" %>',
// streetAddress: '<%# shipping_address.address1 %>',
// extendedAddress: '<%# shipping_address.address2 %>',
// locality: '<%# shipping_address.city %>',
// countryCodeAlpha2: '<%# shipping_address.country.try(:iso) %>',
// postalCode: '<%# shipping_address.zipcode %>',
// region: '<%# shipping_address.state.try(:abbr) %>',
// phone: '<%# shipping_address.phone %>',
// editable: false
// },
app/views/spree/braintree_vzero/_paypal_checkout.html.erb
enableShippingAddress: false,
enableBillingAddress: false,
from spree_braintree_vzero.
@dieuit07 I'm going to assume you are trying to skip the address step where a customer clicks on the 'checkout with paypal' button from the cart page. Is this correct? (The following explanation is assuming this is the case, note that I required a confirmation step in my checkout flow but you may not need this):
- Remove requirement for phone number using an address_decorator (apparently Paypal does not pass back a phone number)
Spree::Address.class_eval do
def require_phone?
false
end
end
- Create an order decorator to allow the checkout state to move from 'delivery' to 'confirmation' (note the default remove_transition has been commented out), and create an update payment amount method (or the amount appears blank on the confirmation page).
Spree::Order.class_eval do
checkout_flow do
go_to_state :address
go_to_state :delivery
go_to_state :payment, if: ->(order) { order.payment_required? }
go_to_state :confirm, if: ->(order) { order.confirmation_required? }
go_to_state :complete
#remove_transition from: :delivery, to: :confirm
end
state_machine.before_transition to: :confirm, do: :update_payment_amount
state_machine.before_transition to: :complete, do: :process_paypal_express_payments
private
def update_payment_amount
return unless paid_with_paypal_express?
payments.last.update(amount: total)
end
end
- Create an orders_controller_decorator and push the order state to 'delivery' by changing the following line in the process_paypal_express method:
Change this line:
payment_method.push_order_to_state(current_order, 'address', email)
to
payment_method.push_order_to_state(current_order, 'delivery', email)
Hope this helps!
EDIT: One point I neglected to mention is that you need to add the following line to your 'config/initializers/spree.rb' file:
Spree::Config[:always_include_confirm_step] = true
from spree_braintree_vzero.
Thanks @mdavo6 . I will try it soon 👍
from spree_braintree_vzero.
Related Issues (20)
- Shipment tax adjustments not created when using Paypal Express
- @Mafi88 There was a JS error that was impacting all pages, fixing this solved the problem. It must have affected some JS related to the checkout.
- PayPal HOT 4
- Template scripts fail to run if "head script" is included with "defer" HOT 1
- Getting ActiveRecord::StatementInvalid in Spree::UserSessionsController#create HOT 2
- uninitialized constant Spree::BraintreeVzero::LegacyRailsPatch
- Payment "source" is nil on PayPalExpress HOT 1
- Dependabot can't resolve your Ruby dependency files
- PayPal Express Checkout not rendering on payment page HOT 2
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- "braintree is not defined" on cart using PayPal Express Checkout HOT 1
- 3D Secure preference has no impact on checkout process
- Drop-in does not appear on backend - source_required?
- Truncate Product Description and Name HOT 7
- Feature Request: PayPal ACDC
- SKU should not be used as product_code for Braintree!
- Switching between payment methods broken by this gem
- 2099 authorisation required error on 3.5.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spree_braintree_vzero.