Skip to content

Commit

Permalink
feat: display purchase details in checkout modal when taxes are enabl…
Browse files Browse the repository at this point in the history
…ed (#1480)
  • Loading branch information
laurelfulford authored Jun 21, 2023
1 parent f89a1db commit b69f8f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
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

0 comments on commit b69f8f3

Please sign in to comment.