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

Update wc 7.8 templates #483

Merged
merged 9 commits into from
Jun 1, 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
3 changes: 2 additions & 1 deletion scss/bootscore_woocommerce/_wc_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ WooCommerce Buttons
// Add to cart buttons
.woocommerce .card a.button,
.woocommerce div.product form.cart button.button,
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button,
#place_order {
@extend .btn;
@extend .btn-primary;
}
105 changes: 65 additions & 40 deletions scss/bootscore_woocommerce/_wc_checkout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,76 @@ WooCommerce Checkout
}


// Hide Paypal img and link
#payment .payment_method_paypal img,
.woocommerce-checkout #payment .payment_method_paypal .about_paypal {
display: none;
// #order_review
// Set shipping table to top
.woocommerce-shipping-totals th {
vertical-align: top;
}


// Override WC border-radius: 5px; in #payment card
#add_payment_method #payment,
.woocommerce-cart #payment,
// #payment
.woocommerce-checkout #payment {
border-radius: $border-radius;

// Create card
background: $card-bg;
border: $card-border-width solid $card-border-color;
border-radius: $card-border-radius;
padding: $card-spacer-y $card-spacer-x;

ul.payment_methods {
border-bottom: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
padding: 0;
margin-bottom: $spacer;

li {
line-height: inherit;

// Adjust payment method checkboxes
input {
margin-top: ($line-height-base - $form-check-input-width) * .5;
margin-right: $form-check-input-width * .5;
margin-bottom: 0;
margin-left: -$spacer * 1.5;
}
}

// Payment information
div.payment_box {
border-radius: $border-radius;
font-size: $font-size-base;
}

// Hide Paypal img and link
.payment_method_paypal {

img,
.about_paypal {
display: none;
}
}
}

// Policy & place-order wrapper
div.form-row {
padding: 0;
margin: 0;
}

// Place ordere button
#place_order {
@extend .btn-lg;
width: 100%;
margin-bottom: 0;
}
}


// Set shipping table to top
.woocommerce-shipping-totals th {
vertical-align: top;
// Adjust terms checkboxes
.woocommerce form .form-row .input-checkbox {
margin-top: ($line-height-base - $form-check-input-width) * .5 !important;
margin-right: $form-check-input-width * .5 !important;
margin-bottom: 0 !important;
margin-left: -$spacer * 1.5 !important;
}


Expand All @@ -46,14 +98,6 @@ WooCommerce Checkout
padding: $spacer;
}


// Payment box
.woocommerce-checkout #payment div.payment_box {
border-radius: $border-radius;
font-size: $font-size-base;
}


// Payment saved cards radios
.woocommerce-SavedPaymentMethods.wc-saved-payment-methods {
padding-left: 0;
Expand All @@ -77,7 +121,7 @@ WooCommerce Checkout
}
}


// Stripe
// Stripe credit card input
.wc-stripe-elements-field,
.wc-stripe-iban-element-field {
Expand All @@ -93,7 +137,7 @@ WooCommerce Checkout
}


// Save payment inrormation check
// Save payment information check
.form-row.woocommerce-SavedPaymentMethods-saveNew.woocommerce-validated {
@extend .form-check;

Expand All @@ -107,23 +151,4 @@ WooCommerce Checkout
cursor: pointer;
}

}


// Adjust terms checkboxes
.woocommerce form .form-row .input-checkbox {
margin-top: ($line-height-base - $form-check-input-width) * .5 !important;
margin-right: $form-check-input-width * .5 !important;
margin-bottom: 0 !important;
margin-left: -$spacer * 1.5 !important;
}


// Place order button
.woocommerce #payment #place_order,
.woocommerce-page #payment #place_order {
width: 100%;
margin-top: $spacer;
margin-bottom: 0;
float: none;
}
38 changes: 30 additions & 8 deletions woocommerce/cart/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce\Templates
* @version 7.4.0
* @version 7.8.0
*/

defined('ABSPATH') || exit;
Expand Down Expand Up @@ -41,7 +41,14 @@
foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
$_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
$product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);

/**
* Filter the product name.
*
* @since 7.8.0
* @param string $product_name Name of the product in the cart.
*/
$product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key );

if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_cart_item_visible', true, $cart_item, $cart_item_key)) {
$product_permalink = apply_filters('woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink($cart_item) : '', $cart_item, $cart_item_key);
?>
Expand All @@ -54,7 +61,8 @@
sprintf(
'<a href="%s" class="text-danger" aria-label="%s" data-product_id="%s" data-product_sku="%s"><i class="fa-regular fa-trash-can"></i></a>',
esc_url(wc_get_cart_remove_url($cart_item_key)),
esc_html__('Remove this item', 'woocommerce'),
/* translators: %s is the product name */
esc_attr( sprintf( __( 'Remove %s from cart', 'woocommerce' ), $product_name ) ),
esc_attr($product_id),
esc_attr($_product->get_sku())
),
Expand All @@ -78,9 +86,23 @@
<td class="product-name" data-title="<?php esc_attr_e('Product', 'woocommerce'); ?>">
<?php
if (!$product_permalink) {
echo wp_kses_post(apply_filters('woocommerce_cart_item_name', esc_html($_product->get_name()), $cart_item, $cart_item_key) . '&nbsp;');
/**
* Filter the product name.
*
* @since 7.8.0
* @param string $product_name Name of the product in the cart.
* @param array $cart_item The product in the cart.
* @param string $cart_item_key Key for the product in the cart.
*/
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $product_name, $cart_item, $cart_item_key ) . '&nbsp;' );
} else {
echo wp_kses_post(apply_filters('woocommerce_cart_item_name', sprintf('<a href="%s">%s</a>', esc_url($product_permalink), esc_html($_product->get_name())), $cart_item, $cart_item_key));
/**
* Filter the product name.
*
* @since 7.8.0
* @param string $product_url URL the product in the cart.
*/
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $product_name ), $cart_item, $cart_item_key ) );
}

do_action('woocommerce_after_cart_item_name', $cart_item, $cart_item_key);
Expand Down Expand Up @@ -112,7 +134,7 @@
'input_value' => $cart_item['quantity'],
'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0',
'product_name' => $_product->get_name(),
'product_name' => $product_name,
),
$_product,
false
Expand Down Expand Up @@ -142,9 +164,9 @@
<?php if (wc_coupons_enabled()) { ?>
<div class="coupon">
<div class="input-group">
<input type="text" name="coupon_code" class="form-control" id="coupon_code" value="" placeholder="<?php esc_attr_e('Coupon code', 'woocommerce'); ?>" />
<input type="text" name="coupon_code" class="form-control" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" />
<label for="coupon_code" class="screen-reader-text"><?php esc_html_e( 'Coupon:', 'woocommerce' ); ?></label>
<button type="submit" class="input-group-text btn btn-outline-primary<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>"><?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?></button>
<button type="submit" class="button<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>"><?php esc_html_e( 'Apply coupon', 'woocommerce' ); ?></button>
<?php do_action('woocommerce_cart_coupon'); ?>
</div>
</div>
Expand Down
16 changes: 10 additions & 6 deletions woocommerce/cart/mini-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce\Templates
* @version 5.2.0
* @version 7.8.0
*/

defined('ABSPATH') || exit;
Expand All @@ -33,6 +33,11 @@
$product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);

if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key)) {
/**
* Filter the product name.
*
* @param string $product_name Name of the product in the cart.
*/
$product_name = apply_filters('woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key);
$thumbnail = apply_filters('woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key);
$product_price = apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $cart_item, $cart_item_key);
Expand Down Expand Up @@ -72,15 +77,14 @@
</div>
</div>



<div class="remove col-2 text-end">
<?php echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'woocommerce_cart_item_remove_link',
sprintf(
'<a href="%s" class="remove_from_cart_button text-danger" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s"><i class="fa-regular fa-trash-can"></i></a>',
esc_url(wc_get_cart_remove_url($cart_item_key)),
esc_attr__('Remove this item', 'woocommerce'),
/* translators: %s is the product name */
esc_attr( sprintf( __( 'Remove %s from cart', 'woocommerce' ), $product_name ) ),
esc_attr($product_id),
esc_attr($cart_item_key),
esc_attr($_product->get_sku())
Expand All @@ -102,7 +106,7 @@
?>
</div>

<div class="cart-footer bg-light text-center p-3">
<div class="cart-footer bg-body-tertiary text-center p-3">

<p class="woocommerce-mini-cart__total total">
<?php
Expand Down Expand Up @@ -131,4 +135,4 @@

<?php endif; ?>

<?php do_action('woocommerce_after_mini_cart'); ?>
<?php do_action('woocommerce_after_mini_cart'); ?>
67 changes: 0 additions & 67 deletions woocommerce/checkout/payment.php

This file was deleted.

Loading