WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
We want to have greater control over where we send merchants to add payment methods since it happens outside of WP Admin and the URL might change in the future - but it's a primary function that should always be supported.
Related issue(s)
Fixes #2735
Similar work was done in 452-gh-woocommerce/woocommerce-shipping
Steps to reproduce
We have two location that are affected by this change: The settings page and the "purchase" button.
Checkout branch locally and activate WCS&T
Go to /wp-admin/admin.php?page=wc-settings&tab=shipping§ion=woocommerce-services-settings
Click Choose a different card (or directly add a payment method if you do not have one or more cards attached to your WPCOM account)
Press the Add another credit card button
Verify you were sent to https://wordpress.com/me/purchases/add-credit-card
Edit an order that has a shippable product (/wp-admin/admin.php?page=wc-orders&action=edit&id={SOMETHING})
Open the shipping label modal by clicking on the Create shipping label button
(Situation A) If it's a fresh WPCOM user, then you should see a "Add credit card" button
(Situation B) If you already have one or more payment methods attach to your WPCOM account, then you can force the "Add credit card" state by:
Open client/extensions/woocommerce/woocommerce-services/views/shipping-label/label-purchase-modal/purchase-section/index.js in your IDE
Change the return of <PurchaseSection> to just ignore the surrounding conditions and just render the "Add credit card" CreditCardButton component.
Click either the "Add credit card" button or the "add a credit card to your account" link in the description below the button
Both the link and button uses the same function, so they're technically identical and one will validate the other.
Verify you were sent to https://wordpress.com/me/purchases/add-credit-card
Description
We want to have greater control over where we send merchants to add payment methods since it happens outside of WP Admin and the URL might change in the future - but it's a primary function that should always be supported.
Related issue(s)
Steps to reproduce
We have two location that are affected by this change: The settings page and the "purchase" button.
/wp-admin/admin.php?page=wc-settings&tab=shipping§ion=woocommerce-services-settings
Choose a different card
(or directly add a payment method if you do not have one or more cards attached to your WPCOM account)Add another credit card
buttonhttps://wordpress.com/me/purchases/add-credit-card
/wp-admin/admin.php?page=wc-orders&action=edit&id={SOMETHING}
)Create shipping label
buttonclient/extensions/woocommerce/woocommerce-services/views/shipping-label/label-purchase-modal/purchase-section/index.js
in your IDE<PurchaseSection>
to just ignore the surrounding conditions and just render the "Add credit card"CreditCardButton
component.https://wordpress.com/me/purchases/add-credit-card
Screenshots/GIFs
Settings page
Purchase modal
Checklist
changelog.txt
entry addedreadme.txt
entry added