-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizer: Simple Payments Widget breaks when starting without products #9809
Customizer: Simple Payments Widget breaks when starting without products #9809
Conversation
I'd like to propose two changes relevant to this PR:
|
20f0b95
to
f9a214c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gwwar Technically yes, but folks might get confused into thinking that the only choice they have is to create a new SP (good if they actually don't have any SP yet; bad otherwise). Though, I agree that this is too big for this PR, and should move into a follow up. But! I still stand behind my first point, which should be simple enough to implement here.
|
…th an empty list of products
0a097ca
to
573f505
Compare
* Widgets: Adds support for Simple Payment Buttons as Widgets * Simple Payments Widget: Add style overrides (#9580) Override the media query and ensure that Simple Payments widgets are always displayed as a single column. * Widgets: Only render the Simple Payments widget if its button exists (#9673) In the frontend, only show the widget if the Simple Payments shortcode is parsed successfully. In the customizer, show the widget regardless, so that it can be modified via the pencil icon. * Simple Payment Widget: Manage Products from the Customizer (#9699) * Customizer: Simple Payments Widget breaks when starting without products (#9809) * Widgets: Hide Simple Payments create and edit buttons in widgets.php (#9811) * Widgets: Record events for the Simple Payments widget (#9803) * Widgets: Add Plan Check to the Simple Payments Widget (#9824) * Customizer: keep Simple Payments Widget Customizer in sync between instances (#9814) * Customizer: improves price validation on the Simple Payments Widget Customizer * Customizer: improves the behaviour of the action buttons on the Simple Payments Widget Customizer
This PR fixes a number of issues with the Simple Payments Widget Customizer when the user has either a single product, or no product at all, including:
Changes proposed in this Pull Request:
The customizer tool now shows a message when the user has no products loaded.
It also makes the first product the explicit default on
$instance
when the widget is first added, instead of having thewidget
function make the choice.It also adds logic to
customizer.js
to manage the visibility of the new message and the product drop down list.Testing instructions:
For all cases, please start with an Professional Jetpack site with no previously created Simple Payment products. If you have some, please delete them on Calypso's Editor before testing this PR.
PHP Warnings
Adding a widget when the user has no products fires this PHP warning (as seen on the error log):
That may show on some themes:
To verify that this is no longer the case, just add a SP Widget to a sidebar/footer on a site with no previous products and verify that the warning is now present on the
error_log
or in the page itself.Edit a Product after adding it
The form should load with the correct information of the recently added product. The Customizer preview should update any changes live, and the changes should be persisted without problems.
Repeat for as many products as you'd like.
Edit a Single Product
The form should load with the correct information of the single product. The Customizer preview should update any changes live, and the changes should be persisted without problems.
Delete all Products
When no more products are present, the empty list message should be displayed and the drop down list is no longer visible.
The drop down list should be restored, the empty list message hidden and the new product should load correctly on the customizer preview.
The form should load the newly created product, and changes should be correctly saved.
Known issues: