Skip to content

Instantly share code, notes, and snippets.

@mi-ca
Created November 26, 2020 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mi-ca/e823e1029c2bb36c609c3ae3eda34222 to your computer and use it in GitHub Desktop.
Save mi-ca/e823e1029c2bb36c609c3ae3eda34222 to your computer and use it in GitHub Desktop.
Woocommerce cart & checkout skinning
<?php
/* code à ajouter au functions.php
// WOOCOMMERCE special styling
// charge une css à ajouter dans le dossier du child-theme enfold perso APRES celle d'Enfold -> du coup elle prend le dessus
function wc29d_scripts(){
wp_enqueue_style( 'wc29d-css', get_stylesheet_directory_uri() . '/wc_29degres.css', array('avia-style'), null );
}
// chagement des styles et scripts
add_action( 'wp_enqueue_scripts', 'wc29d_scripts' );
//---------
//---- supprimer le panier par defaut de enfold
add_action('after_setup_theme','ava_woocommerce_mod', 100);
function ava_woocommerce_mod() {
remove_action( 'init', 'avia_woocommerce_cart_placement', 10);
}
// Supprime le titre des Notes de commande - Additional Information & Notes Field
add_filter( 'woocommerce_enable_order_notes_field', '__return_false', 9999 );
// Supprime les Notes de commande
add_filter( 'woocommerce_checkout_fields' , 'remove_order_notes' );
function remove_order_notes( $fields ) {
unset($fields['order']['order_comments']);
return $fields;
}
:root {
--formFontSize: 18px;
--gap : 50px;
--formMaxWidth: 822px;
--shopTableImgSize: 130px;
/* définition des couleurs */
--black: #000;
--darkgrey: #666;
--buttonTextColor: #fff;
--mainColor:#6aa840;
--mainColorHover: #a9c297;
--borderColor:#488620;
--borderColorHover:#87a075;
--removeHover: #800;
/* bouton arrondis */
--borderRadius : 2px;
/* définition des anim */
--bounce: cubic-bezier(0.23, 1.4, 0.320, 1);
}
div.cart_totals .cart-subtotal,
div.cart_totals h2, /* cache le titre du tableau résumé de la commande */
.added_to_cart.wc-forward{/* cache le lien voir le panier de base de woocommerce lorsque l'on click sur ajouter au panier */
display: none;
}
/*---*/
table.cart img{
width: var(--shopTableImgSize);
}
.main_color table.shop_table thead,
.main_color table.shop_table thead tr,
.main_color table.shop_table thead th {
background: none;
font-size: 1rem;
color: var(--mainColor);
border: none;
}
.main_color table.shop_table tr:nth-child(even),
.main_color table.shop_table tr:nth-child(odd),
.main_color table.shop_table .pricing-table>li:nth-child(odd),
.main_color table.shop_table .pricing-extra,
.main_color table.shop_table {
background: none;
border: none;
color: var(--darkgrey);
}
tr th:first-child,
tr td:first-child,
.main_color table.shop_table td {
border-left-style: none;
border-right-style: none;
border-bottom: 1px solid #e1e1e1;
font-size: 1rem;
}
.main_color table.shop_table .product-name{
/*display: grid;
grid-template-rows: repeat (3,1fr);
grid-template-areas: "title"
"variations"
"editOptions";*/
}
.product-quantity{
text-align: center;
}
.woocommerce-checkout-review-order-table tfoot tr:first-child th,
.woocommerce-checkout-review-order-table tfoot tr:first-child td{
padding-top: var(--gap);
}
.woocommerce-checkout-review-order-table .cart-subtotal td,
.woocommerce-checkout-review-order-table .order-total td,
.product-total,
.product-subtotal,
.product-price{
text-align: right;
}
.main_color table.shop_table .product-name a:first-child{
text-transform: uppercase;
grid-area: title;
}
.main_color table.shop_table .product-name .variation{
grid-area: variations;
}
.main_color table.shop_table .product-name a.tm-cart-edit-options{
grid-area: editOptions;
}
.product-remove a{
transition: all .3s var(--bounce);
}
#top .main_color .product-remove a.remove:hover{
background-color: var(--removeHover);
transform: rotate(180deg);
}
#top .main_color table.shop_table .quantity input.plus,
#top .main_color table.shop_table .quantity input.minus,
button[name="woocommerce_checkout_place_order"],
table.shop_table .quantity input[type=button] {
font-size: 1.2rem;
color: var(--mainColor);
font-weight: 800;
background: none;
border: none;
}
div table.shop_table td.actions {
border: none;
padding-top: var(--gap);
}
div.cart_totals tr.order-total th,
div.cart_totals tr.order-total td{
border: none;
text-align: right;
padding: 0.6rem;
line-height: 1;
}
.cart-collaterals .wc-proceed-to-checkout,
.cart-collaterals .cart_totals{
float: right;
}
#top div form .form-row input.input-text,
#top div #content .form-row input.input-text,
#top div form .form-row textarea,
#top div #content .form-row textarea,
.cart-collaterals .cart_totals a.button.alt{
/*.cart-collaterals .wc-proceed-to-checkout a.checkout-button{*/
font-size: var(--formFontSize);
}
.col2-set .col-1{
max-width: var(--formMaxWidth)
margin: 0 auto;
float: none;
}
h3#order_review_heading,
table.shop_table.woocommerce-checkout-review-order-table{
margin-left: auto;
margin-right: auto;
max-width: var(--formMaxWidth)
}
/* cache le sorting dropdown -> pas trouvé le hook pour les virer */
#top div.product-sorting {display:none;}
/* SIDE CART */
.xoo-wsc-footer a.button{
border-radius: var(--borderRadius);
background-color: var(--mainColor);
color:var(--buttonTextColor);
border-color: var(--borderColor);
transition: all .3s var(--bounce);
}
.xoo-wsc-footer a.button:hover{
background-color: var(--mainColorHover);
color:var(--buttonTextColor);
border-color: var(--borderColorHover);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment