Skip to content
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

feat: display purchase details in checkout modal when taxes are enabled #1480

Merged
merged 2 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/modal-checkout/checkout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
}
}
}
.woocommerce-checkout-review-order-table {
margin-top: 16px;
th,
td {
font-size: 0.8rem;
}
}
.woocommerce-billing-fields {
margin-bottom: 16px;
}
Expand Down
18 changes: 5 additions & 13 deletions src/modal-checkout/templates/checkout-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce hooks.
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variables.

$order_details_display = get_theme_mod( 'collapse_order_details', 'hide' );

$has_filled_billing = \Newspack_Blocks\Modal_Checkout::has_filled_required_fields( 'billing' );
$edit_billing = ! $has_filled_billing || isset( $_REQUEST['edit_billing'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended

Expand All @@ -40,17 +38,6 @@
wp_nonce_field( 'newspack_blocks_edit_billing', 'newspack_blocks_edit_billing_nonce' );
}
?>
<?php if ( 'toggle' === $order_details_display ) : ?>
<div class="cart-summary-header">
<h3><?php esc_html_e( 'Summary', 'newspack-blocks' ); ?></h3>
<button id="toggle-order-details" class="order-details-hidden" on="tap:AMP.setState( { orderVisible: !orderVisible } )" [class]="orderVisible ? '' : 'order-details-hidden'" aria-controls="full-order-details" [aria-expanded]="orderVisible ? 'true' : 'false'" aria-expanded="false">
<?php echo wp_kses( newspack_get_icon_svg( 'chevron_left', 24 ), newspack_sanitize_svgs() ); ?>
<span [text]="orderVisible ? '<?php esc_html_e( 'Hide details', 'newspack-blocks' ); ?>' : '<?php esc_html_e( 'Show details', 'newspack-blocks' ); ?>'"><?php esc_html_e( 'Show details', 'newspack-blocks' ); ?></span>
</button>
</div>
<?php endif; ?>

<?php if ( 'display' !== $order_details_display ) : ?>
<div class="order-details-summary">
<?php
// Simplified output of order.
Expand Down Expand Up @@ -78,6 +65,11 @@
}
?>
</div><!-- .order-details-summary -->

<?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() && ! $edit_billing ) : ?>
<div id="order_review" class="woocommerce-checkout-review-order">
<?php do_action( 'woocommerce_checkout_order_review' ); ?>
</div>
<?php endif; ?>

<?php if ( $checkout->get_checkout_fields() ) : ?>
Expand Down