Skip to content

Commit

Permalink
add style fix for payment template
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbot committed Nov 18, 2023
1 parent 8b8358c commit 2a772bc
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 41 deletions.
1 change: 1 addition & 0 deletions includes/Services/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Settings {
'dequeue_script_handles' => array(
'admin-bar',
'wc-add-to-cart',
'wc-stripe-upe-classic',
),
'dequeue_style_handles' => array(
'admin-bar',
Expand Down
89 changes: 48 additions & 41 deletions templates/payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* HOWEVER, this is not recommended , don't be surprised if your POS breaks
*/

defined( 'ABSPATH' ) || exit;
\defined( 'ABSPATH' ) || exit;
?>
<!doctype html>
<html <?php language_attributes(); ?>>
Expand All @@ -20,6 +20,8 @@
font-size: 14px;
margin: 0 !important;
padding: 0 !important;
color: #000000 !important;
background-color: #ffffff !important;
}
h1, h2, h3, h4, h5, h6 {
margin: 0;
Expand Down Expand Up @@ -52,6 +54,11 @@
margin-bottom: 4px;
}

.woocommerce {
color: #000000 !important;
background-color: #ffffff !important;
}

.woocommerce-pos-troubleshooting {
border-left: 4px solid #007cba; /* For the blue vertical line */
padding: 5px 10px; /* Padding around the text */
Expand Down Expand Up @@ -258,23 +265,23 @@

<body <?php body_class(); ?>>
<div class="woocommerce"><?php
global $wp_styles, $wp_scripts;
$styleHandles = $wp_styles->queue;
$scriptHandles = $wp_scripts->queue;

$style_exclude_list = apply_filters(
'woocommerce_pos_payment_template_dequeue_style_handles',
woocommerce_pos_get_settings( 'checkout', 'dequeue_style_handles' )
);

$script_exclude_list = apply_filters(
'woocommerce_pos_payment_template_dequeue_script_handles',
woocommerce_pos_get_settings( 'checkout', 'dequeue_script_handles' )
);

$mergedStyleHandles = array_unique(array_merge($styleHandles, $style_exclude_list));
$mergedScriptHandles = array_unique(array_merge($scriptHandles, $script_exclude_list));
?>
global $wp_styles, $wp_scripts;
$styleHandles = $wp_styles->queue;
$scriptHandles = $wp_scripts->queue;

$style_exclude_list = apply_filters(
'woocommerce_pos_payment_template_dequeue_style_handles',
woocommerce_pos_get_settings( 'checkout', 'dequeue_style_handles' )
);

$script_exclude_list = apply_filters(
'woocommerce_pos_payment_template_dequeue_script_handles',
woocommerce_pos_get_settings( 'checkout', 'dequeue_script_handles' )
);

$mergedStyleHandles = array_unique(array_merge($styleHandles, $style_exclude_list));
$mergedScriptHandles = array_unique(array_merge($scriptHandles, $script_exclude_list));
?>

<div class="woocommerce-pos-troubleshooting notice notice-warning is-dismissible">
<p class="link">
Expand All @@ -285,23 +292,23 @@
<div style="display: flex; justify-content: space-between;">
<div>
<h3><?php _e('Styles', 'woocommerce-pos'); ?></h3>
<?php foreach ($mergedStyleHandles as $handle) :
$checked = !in_array($handle, $style_exclude_list) ? 'checked' : '';
?>
<?php foreach ($mergedStyleHandles as $handle) {
$checked = ! \in_array($handle, $style_exclude_list, true) ? 'checked' : '';
?>
<input type="checkbox" id="<?php echo $handle; ?>" name="styles[]" value="<?php echo $handle; ?>" <?php echo $checked; ?>>
<label for="<?php echo $handle; ?>"><?php echo $handle; ?></label>
<input type="hidden" name="all_styles[]" value="<?php echo $handle; ?>"><br>
<?php endforeach; ?>
<?php } ?>
</div>
<div>
<h3><?php _e('Scripts', 'woocommerce-pos'); ?></h3>
<?php foreach ($mergedScriptHandles as $handle) :
$checked = !in_array($handle, $script_exclude_list) ? 'checked' : '';
?>
<?php foreach ($mergedScriptHandles as $handle) {
$checked = ! \in_array($handle, $script_exclude_list, true) ? 'checked' : '';
?>
<input type="checkbox" id="<?php echo $handle; ?>" name="scripts[]" value="<?php echo $handle; ?>" <?php echo $checked; ?>>
<label for="<?php echo $handle; ?>"><?php echo $handle; ?></label>
<input type="hidden" name="all_scripts[]" value="<?php echo $handle; ?>"><br>
<?php endforeach; ?>
<?php } ?>
</div>
</div>
<input type="hidden" name="troubleshooting_form_nonce" value="<?php echo $troubleshooting_form_nonce; ?>" />
Expand Down Expand Up @@ -335,13 +342,13 @@
<address>
<?php echo wp_kses_post( $order->get_formatted_billing_address( esc_html__( 'N/A', 'woocommerce' ) ) ); ?>

<?php if ( $order->get_billing_phone() ) : ?>
<?php if ( $order->get_billing_phone() ) { ?>
<p class="woocommerce-customer-details--phone"><?php echo esc_html( $order->get_billing_phone() ); ?></p>
<?php endif; ?>
<?php } ?>

<?php if ( $order->get_billing_email() ) : ?>
<?php if ( $order->get_billing_email() ) { ?>
<p class="woocommerce-customer-details--email"><?php echo esc_html( $order->get_billing_email() ); ?></p>
<?php endif; ?>
<?php } ?>
</address>

</div><!-- /.col-1 -->
Expand All @@ -351,9 +358,9 @@
<address>
<?php echo wp_kses_post( $order->get_formatted_shipping_address( esc_html__( 'N/A', 'woocommerce' ) ) ); ?>

<?php if ( $order->get_shipping_phone() ) : ?>
<?php if ( $order->get_shipping_phone() ) { ?>
<p class="woocommerce-customer-details--phone"><?php echo esc_html( $order->get_shipping_phone() ); ?></p>
<?php endif; ?>
<?php } ?>
</address>
</div><!-- /.col-2 -->

Expand All @@ -376,15 +383,15 @@

<?php
$coupons = $order->get_items( 'coupon' );
if ( $coupons ) {
echo '<h3>' . __('Applied coupons', 'woocommerce') . '</h3>';
echo '<ul>';
foreach ( $coupons as $coupon ) {
echo '<li>' . esc_html( $coupon->get_code() ) . ' <button type="submit" class="button" name="pos_remove_coupon" value="' . esc_attr( $coupon->get_code() ) . '">' . esc_html__( 'Remove', 'woocommerce' ) . '</button></li>';
}
echo '</ul>';
}
?>
if ( $coupons ) {
echo '<h3>' . __('Applied coupons', 'woocommerce') . '</h3>';
echo '<ul>';
foreach ( $coupons as $coupon ) {
echo '<li>' . esc_html( $coupon->get_code() ) . ' <button type="submit" class="button" name="pos_remove_coupon" value="' . esc_attr( $coupon->get_code() ) . '">' . esc_html__( 'Remove', 'woocommerce' ) . '</button></li>';
}
echo '</ul>';
}
?>
</form>
</div>

Expand Down

0 comments on commit 2a772bc

Please sign in to comment.