-
Notifications
You must be signed in to change notification settings - Fork 6
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
Gutenberg Cart block #20
Conversation
… into gutenberg-block
… into gutenberg-block
… into gutenberg-block
… to the editor styles
… into gutenberg-block
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.
Great work, just one minor comment! 💪
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.
No new issues to report!
Same here. prior fatal errors about regarding Session are gone. cart loads and behaves normally on it's pages |
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.
✔️ Looks good to me! Now the menu cart follows the Show on cart & checkout page setting, as well as the Always display cart, even if it's empty and Display shopping cart icon settings.
… into gutenberg-block
closes #19
Steps to add the cart to the navigation block
+
button to add a new link:Technical considerations
I needed to change the block type from
static
todynamic
because when the cart contents change the block triggers an error in the editor (image below), content can't be changed usingstatic
blocks.Gutenberg knows this is
dynamic
block by returningnull
on thesave
function:I discover also that dynamic blocks can be rendered from PHP using ServerSideRender.
This block is a children from
parent: [ 'core/navigation' ],
and has atransform
property that converts fromcore/navigation-link
to ourblock
:I have also fixed an issue loading the cart on the full site editor, where the session was returning
null
.