-
Notifications
You must be signed in to change notification settings - Fork 221
Add order confirmation wrapper block #10286
Add order confirmation wrapper block #10286
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
This comment was automatically generated by the TypeScript Errors Report
assets/js/blocks/cart-checkout-shared/payment-methods/express-payment-methods.js
assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-card.js assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-error-boundary.js assets/js/blocks/classic-template/test/utils.ts assets/js/blocks/mini-cart/edit.tsx assets/js/blocks/order-confirmation/billing-address/index.tsx assets/js/blocks/order-confirmation/billing-wrapper/index.tsx assets/js/blocks/order-confirmation/downloads/edit.tsx assets/js/blocks/order-confirmation/downloads/index.tsx assets/js/blocks/order-confirmation/shipping-address/index.tsx assets/js/blocks/order-confirmation/status/index.tsx assets/js/blocks/order-confirmation/summary/edit.tsx assets/js/blocks/order-confirmation/summary/index.tsx assets/js/blocks/order-confirmation/totals/edit.tsx assets/js/blocks/order-confirmation/totals/index.tsx assets/js/blocks/product-gallery/edit.tsx assets/js/hocs/test/with-searched-products.js assets/js/interactivity/router.js |
Size Change: +1.1 kB (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
This PR has been marked as If deemed still relevant, the pr can be kept active by ensuring it's up to date with the main branch and removing the stale label. |
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.
Left a few minor suggestions. In testing, the wrapper worked, but I got this for the contents:
Your site doesn’t include support for the "woocommerce/order-confirmation-billing-address" block. You can leave this block intact or remove it entirely.
Not sure why its not being found. Can you reproduce?
"name": "woocommerce/order-confirmation-billing-wrapper", | ||
"version": "1.0.0", | ||
"title": "Order Confirmation Billing wrapper", | ||
"description": "Display the order confirmation billing wrapper.", |
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.
Wrapper is a technical term so let's describe this as "Order Confirmation Billing Section"
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.
I updated the title and description of the Billing Wrapper as suggested! 👍
protected function render( $attributes, $content, $block ) { | ||
$order = $this->get_order(); | ||
|
||
if ( ! $order || ! $this->is_current_customer_order( $order ) || ! $order->has_billing_address() ) { |
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'll need to tweak this to account for #10414 but its fine for now.
@mikejolley! I just spotted the bug about the broken block! It was the "parent" keyword in Block.json. I pushed a fix! Could you please check again? |
'<div class="wc-block-%4$s %1$s %2$s">%3$s</div>', | ||
esc_attr( $classes_and_styles['classes'] ), | ||
esc_attr( $classname ), | ||
$content, |
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.
@mikejolley, I ended up using the provided $content
attribute directly to render the Billing Address
Inner Block. I initially used the following logic to get the Inner Blocks:
$inner_blocks_html = '';
foreach ( $block->inner_blocks as $inner_block ) {
$inner_blocks_html .= $inner_block->render();
}
$content = $inner_blocks_html;
So, I'm not certain which approach is the best!
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.
Initial content is probably ok for this if it works.
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 now. Small case change needed but otherwise
Co-authored-by: Mike Jolley <mike.jolley@me.com>
c26ee92
to
278b116
Compare
* Add a heading wrapper block * Register the BillingWrapper Block server side * Fix exception 'render_content' error * Add the Billing Wrapper Block to the template * Fix wrong block name error * Fix php error * Conditionally render Billing Address within the Wrapper * Fix parent rendering * Clean up code (remove billing address from the template) * Update titles, descriptions, and icons of the billing Block and inner block * Fix broken block by removing the "parent" keyword * Use a user-friendly title and description for the Billing Wrapper * Update Billing Wrapper Block's title case Co-authored-by: Mike Jolley <mike.jolley@me.com> * Fix PHP failing unit test --------- Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add a heading wrapper block * Register the BillingWrapper Block server side * Fix exception 'render_content' error * Add the Billing Wrapper Block to the template * Fix wrong block name error * Fix php error * Conditionally render Billing Address within the Wrapper * Fix parent rendering * Clean up code (remove billing address from the template) * Update titles, descriptions, and icons of the billing Block and inner block * Fix broken block by removing the "parent" keyword * Use a user-friendly title and description for the Billing Wrapper * Update Billing Wrapper Block's title case Co-authored-by: Mike Jolley <mike.jolley@me.com> * Fix PHP failing unit test --------- Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add a heading wrapper block * Register the BillingWrapper Block server side * Fix exception 'render_content' error * Add the Billing Wrapper Block to the template * Fix wrong block name error * Fix php error * Conditionally render Billing Address within the Wrapper * Fix parent rendering * Clean up code (remove billing address from the template) * Update titles, descriptions, and icons of the billing Block and inner block * Fix broken block by removing the "parent" keyword * Use a user-friendly title and description for the Billing Wrapper * Update Billing Wrapper Block's title case Co-authored-by: Mike Jolley <mike.jolley@me.com> * Fix PHP failing unit test --------- Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add a heading wrapper block * Register the BillingWrapper Block server side * Fix exception 'render_content' error * Add the Billing Wrapper Block to the template * Fix wrong block name error * Fix php error * Conditionally render Billing Address within the Wrapper * Fix parent rendering * Clean up code (remove billing address from the template) * Update titles, descriptions, and icons of the billing Block and inner block * Fix broken block by removing the "parent" keyword * Use a user-friendly title and description for the Billing Wrapper * Update Billing Wrapper Block's title case Co-authored-by: Mike Jolley <mike.jolley@me.com> * Fix PHP failing unit test --------- Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Main block types for confirmation * Initial blocks * Styling and placeholders * Make blocks experimental * Update summary icon * Add name/description for status block and missing text descriptions in the block. Closes #10057 * Order confirmation: Convert Order Details Templates to Blocks (#10095) * Move code from templates into the details block * Details -> Totals * Downloads block * Sample content for downloads block * Add block icon * Add conversion template (#10077) * Update inner block name * Add default title constant * Revert "Add default title constant" This reverts commit 1dd3bbf. * Add global styles for order confirmation status block (#10164) * Implement style controls * Prevent link color spilling over onto wrapper * Add styles and remove class names * Remove __experimentalWritingMode * Add global styles for order confirmation summary block (#10179) * Styles for summary * Remove __experimentalWritingMode * Add table styles for order details (#10185) * Add table styles for order details * __experimentalFontWeight * Add link styles * Handle preview link styles * Unauthenticated views for Order Confirmation template (#10414) * Different views by permission * check user id matches when logged out * Add order confirmation wrapper block (#10286) * Add a heading wrapper block * Register the BillingWrapper Block server side * Fix exception 'render_content' error * Add the Billing Wrapper Block to the template * Fix wrong block name error * Fix php error * Conditionally render Billing Address within the Wrapper * Fix parent rendering * Clean up code (remove billing address from the template) * Update titles, descriptions, and icons of the billing Block and inner block * Fix broken block by removing the "parent" keyword * Use a user-friendly title and description for the Billing Wrapper * Update Billing Wrapper Block's title case Co-authored-by: Mike Jolley <mike.jolley@me.com> * Fix PHP failing unit test --------- Co-authored-by: Mike Jolley <mike.jolley@me.com> * Remove "thanks" for authenticated page * Introduce shipping wrapper based on billing wrapper Closes #10053 * Order confirmation block: Verify email address for guest customers (#10567) * Add verify step for guest orders * Render content to pass through block content * Revert package changes * Customer orders cannot use email to verify * Add style controls for order shipping and billing address blocks (#10633) * Order confirmation block styling (#10780) * Add missing heading to order details * Summary block spacing * Update css variables * table styles * Inherit border styles for cells * Alignment and address styles * Add downloads wrapper * Style controls * Fix typo * Update Download Wrapper's Icon * Fix TS error * Disable Download Block's server side rendering in the editor This fixes the loading after each style change from the style controls * Clean up Downloads render functions * Fix client side Downloads Block's table border * Download + Total wrappers and tables styling * small screen * Remove server side render for previews --------- Co-authored-by: Saad Tarhi <saad.trh@gmail.com> * Shorten template description * Update test address data * Avoid leaking order key in permission form * Remove todo * Make email form required. * Remove edit page link * Remove empty columns from address wrapper * Remove IIFE * typo * Update description to mention billing * Adjust link scss * Fix wrapper markup and spacing controls * Add link preview in editor * Add initial E2E setup for the Order Confirmation Block (#10840) * Fix WC_DateTime check * Move form outside of block markup * Add additional information block (#10842) * Add block which contains hooks * Use skeleton for placeholder instead of illustration * Remove duplicate methods * Remove duplicate align tag * Update meta styles * Tests for order confirmation conditional blocks (#10972) * Add tests for conditional blocks * Move setup into test * Add E2E to the the Order Confirmation Block (#10863) * Add editor util functions * Update editor template E2E test * Add the "exact" property for consistency * Skip test Can't get the element in the page. More investigation needed! Skipping for now. * Fix "transformIntoBlocks" logic * Add tests for logged in user * Fix "beforeAll" config * Confirm downloads section is visible when logged in * Create "verifyOrderConfirmationDetails" util function * Add logged in test case * Add Guest user test case * Fix editor e2e testing * Apply a proper teardown * Fix failing tests after logout * Ensure we are logged in before visiting the editor * Ensure to have shipping selected * Wait for changes to be saved on the editor * Ensure shipping options is selected * Remove comment * Ensure we are logged in before going to the admin page * Mark the Order Confirmation as a side effect test * OrderConfirmation blocks are not experimental * resolve merge conflict * Revert package lock changes * Fix enqueue_assets * Fix CSS 404s * Make template tests more robust * Fix page URL for default confirmation page * Try afterEach to log back in * Skip guest/logout use cases Login out causes other tests to fail. We will implement these case when the multiple sign in roles are introduced in the codebase. * Remove tests requiring login out & add comments * Remove unused util functions * Hide confirmation blocks from post editor --------- Co-authored-by: Saad Tarhi <saad.trh@gmail.com> Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
This PR introduces a parent Block for the Billing Address Block. In this parent Block, we are conditionally displaying the Billing Address Block and the heading. We also updated the titles, descriptions, and icons of the Billing Address and the wrapper Blocks.
Fixes #10094, #10054
User Facing Testing
Editor -> Templates -> Order Confirmation
Order Confirmation Block
and click ontransform into blocks
Order Confirmation Order Billing Wrapper
Block. Ensure it has a heading andBilling Address
as Inner Blocks.billing address
block heading and refresh the page. Ensure the changes are applied on the edit and frontend sides.WooCommerce Visibility