From f9ba9a849721eb1d8c1928699a746c66cab1816b Mon Sep 17 00:00:00 2001 From: craftwerk Date: Sat, 29 Jul 2023 21:54:24 +0200 Subject: [PATCH] Delete cart.php and use mask-icon trash for remove btn --- scss/bootscore_woocommerce/_wc_cart.scss | 96 ++++++++++- woocommerce/cart/cart.php | 206 ----------------------- woocommerce/wc-functions.php | 2 +- 3 files changed, 95 insertions(+), 209 deletions(-) delete mode 100644 woocommerce/cart/cart.php diff --git a/scss/bootscore_woocommerce/_wc_cart.scss b/scss/bootscore_woocommerce/_wc_cart.scss index c1968ce6..0af3f5d0 100644 --- a/scss/bootscore_woocommerce/_wc_cart.scss +++ b/scss/bootscore_woocommerce/_wc_cart.scss @@ -5,8 +5,8 @@ WooCommerce Cart // Cart totals .woocommerce .cart-collaterals .cart_totals, .woocommerce-page .cart-collaterals .cart_totals { - float: none; - width: 100%; + //float: none; + //width: 100%; } @@ -56,3 +56,95 @@ WooCommerce Cart @extend .btn-lg; display: block; } + + + + + + + + + + + + +// Remove btn +/* Hide the "x" */ +.woocommerce { + a.remove { + position: relative; + text-indent: -9999px; + border: 0; + + &:hover { + background: none; + } + + /* Add a Fontawesome icon instead */ + /* Learn More in the Following Paragraphs */ + + &::before { + /* + font-family: FontAwesome; + content: "\f2ed"; + color: var(--bscore-remove-invalid, var(--#{$prefix}danger)); + float: left; + text-indent: 0; + font-size: $font-size-base; + */ + + /* + position: absolute; + left: 1.25rem; + top: 50%; + transform: translate(0, -50%); + */ + content: ' '; + text-indent: 0; + //float: left; + position: absolute; + top: 50%; + left: 0; + transform: translate(0, -50%); + + mask-position: center; + mask-repeat: no-repeat; + //mask-size: $font-size-base; + //mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z'/%3E%3C/svg%3E"); + mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='1em' viewBox='0 0 448 512'%3e%3c!--! Font Awesome Free 6.4.0 by %40fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons%2c Inc. --%3e%3cpath d='M170.5 51.6L151.5 80h145l-19-28.4c-1.5-2.2-4-3.6-6.7-3.6H177.1c-2.7 0-5.2 1.3-6.7 3.6zm147-26.6L354.2 80H368h48 8c13.3 0 24 10.7 24 24s-10.7 24-24 24h-8V432c0 44.2-35.8 80-80 80H112c-44.2 0-80-35.8-80-80V128H24c-13.3 0-24-10.7-24-24S10.7 80 24 80h8H80 93.8l36.7-55.1C140.9 9.4 158.4 0 177.1 0h93.7c18.7 0 36.2 9.4 46.6 24.9zM80 128V432c0 17.7 14.3 32 32 32H336c17.7 0 32-14.3 32-32V128H80zm80 64V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16z'/%3e%3c/svg%3e"); + + -webkit-mask-position: center; + -webkit-mask-repeat: no-repeat; + //-webkit-mask-size: $font-size-base; + //-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z'/%3E%3C/svg%3E"); + -webkit-mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' height='1em' viewBox='0 0 448 512'%3e%3c!--! Font Awesome Free 6.4.0 by %40fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons%2c Inc. --%3e%3cpath d='M170.5 51.6L151.5 80h145l-19-28.4c-1.5-2.2-4-3.6-6.7-3.6H177.1c-2.7 0-5.2 1.3-6.7 3.6zm147-26.6L354.2 80H368h48 8c13.3 0 24 10.7 24 24s-10.7 24-24 24h-8V432c0 44.2-35.8 80-80 80H112c-44.2 0-80-35.8-80-80V128H24c-13.3 0-24-10.7-24-24S10.7 80 24 80h8H80 93.8l36.7-55.1C140.9 9.4 158.4 0 177.1 0h93.7c18.7 0 36.2 9.4 46.6 24.9zM80 128V432c0 17.7 14.3 32 32 32H336c17.7 0 32-14.3 32-32V128H80zm80 64V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V192c0-8.8 7.2-16 16-16s16 7.2 16 16z'/%3e%3c/svg%3e"); + + width: $font-size-base; + height: $font-size-base; + background-color: var(--bscore-remove-invalid, var(--#{$prefix}danger)); + } + } + + +} + + + + + +// Coupon +.woocommerce-cart .coupon { + @extend .input-group; + + + + input { + @extend .form-control; + } + + button { + @extend .input-group-text; + //background: green; + } + +} diff --git a/woocommerce/cart/cart.php b/woocommerce/cart/cart.php deleted file mode 100644 index ce72849a..00000000 --- a/woocommerce/cart/cart.php +++ /dev/null @@ -1,206 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - 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 - * @since 2.1.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. - */ - $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); - ?> - - - - - - - - - - - - - - - - - - - - - - - - -
  
- ', - esc_url(wc_get_cart_remove_url($cart_item_key)), - /* translators: %s is the product name */ - esc_attr( sprintf( __( 'Remove %s from cart', 'woocommerce' ), wp_strip_all_tags( $product_name ) ) ), - esc_attr($product_id), - esc_attr($_product->get_sku()) - ), - $cart_item_key - ); - ?> - - get_image(), $cart_item, $cart_item_key); - - if (!$product_permalink) { - echo $thumbnail; // PHPCS: XSS ok. - } else { - printf('%s', esc_url($product_permalink), $thumbnail); // PHPCS: XSS ok. - } - ?> - - %s', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) ); - } - - do_action('woocommerce_after_cart_item_name', $cart_item, $cart_item_key); - - // Meta data. - echo wc_get_formatted_cart_item_data($cart_item); // PHPCS: XSS ok. - - // Backorder notification. - if ($_product->backorders_require_notification() && $_product->is_on_backorder($cart_item['quantity'])) { - echo wp_kses_post(apply_filters('woocommerce_cart_item_backorder_notification', '

' . esc_html__('Available on backorder', 'woocommerce') . '

', $product_id)); - } - ?> -
- cart->get_product_price($_product), $cart_item, $cart_item_key); // PHPCS: XSS ok. - ?> - - is_sold_individually()) { - $product_quantity = sprintf('1 ', $cart_item_key); - } else { - $product_quantity = woocommerce_quantity_input( - array( - 'input_name' => "cart[{$cart_item_key}][qty]", - 'input_value' => $cart_item['quantity'], - 'max_value' => $_product->get_max_purchase_quantity(), - 'min_value' => '0', - 'product_name' => $product_name, - ), - $_product, - false - ); - } - - echo apply_filters('woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item); // PHPCS: XSS ok. - ?> - - cart->get_product_subtotal($_product, $cart_item['quantity']), $cart_item, $cart_item_key); // PHPCS: XSS ok. - ?> -
- - -
-
- - - - -
-
- - - - - - - -
- -
- - - -
-
- -
-
- -
- -
- -
-
- - \ No newline at end of file diff --git a/woocommerce/wc-functions.php b/woocommerce/wc-functions.php index 9939c2d7..8ea7e558 100644 --- a/woocommerce/wc-functions.php +++ b/woocommerce/wc-functions.php @@ -111,7 +111,7 @@ function bs_woocommerce_breadcrumbs() { // Remove cross-sells at cart -remove_action('woocommerce_cart_collaterals', 'woocommerce_cross_sell_display'); +//remove_action('woocommerce_cart_collaterals', 'woocommerce_cross_sell_display'); // Remove cross-sells at cart End