-
Notifications
You must be signed in to change notification settings - Fork 215
Turn current page into the default Cart/Checkout page #6867
Conversation
d45463b to
86d3cad
Compare
|
The release ZIP for this PR is accessible via: |
Script Dependencies ReportThe
This comment was automatically generated by the |
|
Size Change: +1.21 kB (0%) Total Size: 869 kB
ℹ️ View Unchanged
|
7ae3d74 to
eeebaf8
Compare
| <DefaultNotice | ||
| block={ isCheckout ? 'checkout' : 'cart' } | ||
| /> | ||
| <DefaultNotice | ||
| <CartCheckoutSidebarCompatibilityNotice |
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.
Switched to follow design.
| const ORIGINAL_PAGE_ID = | ||
| block === 'checkout' ? CHECKOUT_PAGE_ID : CART_PAGE_ID; | ||
| const settingName = | ||
| block === 'checkout' | ||
| ? 'woocommerce_checkout_page_id' | ||
| : 'woocommerce_cart_page_id'; | ||
|
|
||
| const noticeContent = | ||
| block === 'checkout' | ||
| ? __( | ||
| 'If you would like to use this block as your default checkout, update your page settings', | ||
| 'woo-gutenberg-products-block' | ||
| ) | ||
| : __( | ||
| 'If you would like to use this block as your default cart, update your page settings', | ||
| 'woo-gutenberg-products-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.
We handle Cart and Checkout from this component, everything is the same we just need to have 2 different values.
| <div | ||
| className="wc-blocks-sidebar-compatibility-notice" | ||
| style={ { display: isVisible ? 'block' : 'none' } } | ||
| <Notice | ||
| onRemove={ dismissNotice } | ||
| className={ classnames( [ | ||
| 'wc-blocks-sidebar-compatibility-notice', | ||
| { 'is-hidden': ! isVisible }, | ||
| ] ) } | ||
| > | ||
| <Notice | ||
| onRemove={ dismissNotice } | ||
| className={ 'wc-blocks-sidebar-compatibility-notice__notice' } | ||
| > | ||
| { noticeText } | ||
| </Notice> | ||
| </div> |
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.
Removed the extra div.
70e803b to
7167194
Compare
|
Based on the internal conversation p1660321370894249/1660311130.074619-slack-C8X6Q7XQU we will need to change the implementation:
|
| { isWcVersion( '6.9.0', '>=' ) ? ( | ||
| <DefaultNotice | ||
| block={ isCheckout ? 'checkout' : 'cart' } | ||
| /> | ||
| ) : ( | ||
| <LegacyNotice | ||
| block={ isCheckout ? 'checkout' : 'cart' } | ||
| /> | ||
| ) } | ||
|
|
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.
This logic should handle older versions which doesn't support the setting needed.
|
@senadir Thank you for working on it. If I add a Checkout block and use a button to update the settings, it changes the slug to Screen.Recording.2022-08-19.at.4.34.12.PM.movFor the Cart page, it is not updating the slug for me: Screen.Recording.2022-08-19.at.4.37.13.PM.mov |
|
Can you please remove any existing saved Cart/Checkout page settings you have, it seems your previously default Checkout page has a |
70708b2 to
4e4cc33
Compare
tarunvijwani
left a 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.
Works great! Let's 🚢 it. 👍
|
Thank you for your review, @tarunvijwani! I'm merging this PR to include it in the 8.4.0 release! |
* Add default page notice * show notice all inner blocks * support flow when page isnt saved * switch from where we get the current post id * update lock * fix types * update logic to support cart as well * fix package.json * update design and move away from wc.data * restore notice * handle older versions of WooCommerce * fix package lock * fix typo
This PR adds a "make current page default cart/checkout", it has a long flow that goes via several conditions:
To test this PR, you need this PR from to have the latest trunk of WooCommerce, or WooCommerce 6.9.0
For older versions of WC (pre 6.9.0), the notice would show the old text

Fixes #6864
Fixes #6865
Screenshots
Screen.Recording.2022-08-05.at.23.35.20.mov
User Facing Testing
/cartand/checkout./cart.WooCommerce Visibility
Changelog