Description
Describe the bug
The JavaScript for the Express Pay button puchases on the product page expects fields added by other extensions to use the prefix addon-
woocommerce-payments/client/payment-request/index.js
Lines 176 to 194 in e5bca8d
This isn't always the case, as many extensions (possibly most) use the prefix wc_extensionname
for custom fields on the front end. This is certainly the case with deposits and bookings.
Deposits uses the field wc_deposit_option
for selecting whether to pay a deposit or the full amount. Bookings uses a number of fields: wc_bookings_field_start_date_month
, wc_bookings_field_start_date_day
, wc_bookings_field_start_date_year
, min_date
, max_date
and timezone_offset
for daily blocks, others exist for part day blocks.
As a default, I think it would be good to include fields that begin with wc_
in the form values submitted to the express pay buttons. A JavaScript filter could also be made available to allow extensions to add other fields to be included when the express pay buttons add items to carts.
This issue came out of testing deposits compatibility with this extension, see woocommerce-deposits#569.
The result of this assumption for Deposits is that the user always gets charged the full amount when using express pay buttons on the product page. This is regardless of their selection.
To Reproduce
- Activate Payments and Deposits
- Create a product with a deposit: make the deposit optional, ie allow purchesers to chose whether to pay in full or pay a deposit
- Enable Express Pay buttons
- Visit the product create above
- Select "Pay deposit"
- Click an express pay button (eg, Google Pay)
- The full amount will be charged to the user.
Actual behavior
Incomplete form data is used on the product page.
Screenshots
Expected behavior
Full form data be used when adding items to cart for express pay buttons
(In case of Deposits, that selecting deposit results in charging the deposit only)
Desktop (please complete the following information):
- OS: macOS
- Browser Chrome
- Version 120
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
woocommerce-deposits#569.
Activity