WOOCOMMERCE

page-home.php Вывести товары

<div class="products" id="products">
    <div class="container">
        <div class="content-title"><?php the_field('заголовок_блока_товаров'); ?></div>
        <div class="flex_block">
            <?php query_posts('post_type=product & posts_per_page=-1');?>
            <?php if ( have_posts() ) : ?>
            <?php while ( have_posts()) : the_post(); ?>
            <div class="product--inner">
                <?php do_action( 'woocommerce_widget_product_item_start', $args ); ?>
                <div class="titl-block"><?php the_title(); ?></div>
                <div class="miniature">
                    <?php the_post_thumbnail('medium_large'); ?>
                </div>
                <div class="entrytext"><?php the_content(); ?></div>
                
                <div class="price-block"><?php echo $product->get_price_html(); ?></div>
                
                <div class="btn-block">
                    <form class="clearfix" method="post" enctype='multipart/form-data'>
                        <button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="btn btn-go single_add_to_cart_button button alt">Купить сейчас</button>
                        <?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
                    </form>
                </div>
                <?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
            </div>
            <?php endwhile; ?>
            <?php endif; ?>
            <?php wp_reset_query();?>
        </div>
    </div>
</div> 

function.php

//WOOCOMMERCE
//WOOCOMMERCE
//WOOCOMMERCE

//подключение вукомерц
define('WOOCOMMERCE_USE_CSS', false);
add_theme_support( 'woocommerce' );
//подключение вукомерц

// отключить стили
add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
	unset( $enqueue_styles['woocommerce-general'] );	// Remove the gloss
	unset( $enqueue_styles['woocommerce-layout'] );		// Remove the layout
	unset( $enqueue_styles['woocommerce-smallscreen'] );	// Remove the smallscreen optimisation
	return $enqueue_styles;
}
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
//отключить стили

////сообщение добавлено в корзину
//add_filter( 'wc_add_to_cart_message_html', 'filter_function_name_8802', 10, 3 );
//function filter_function_name_8802( $message, $products, $show_qty ){
//	echo '<div class="modal-smg_boby modal-smg-thanks" id="modal-smg-cardadd">
//            <div class="modal-smg_boby-content">
//                <div class="modal-smg">
//                    <div class="modal-smg_container">
//                        <a class="close--modal-smg" href="javascript:PopUpHideCardadd()"></a>
//                        <div class="thanks-content addcart-modal-content">
//                            <img src="https://img.icons8.com/ios/50/216fed/ok.png">
//                            <div class="title-block">Добавлено в корзину</div>
//                            <div class="btn-block">
//                                <a class="btn" href="/cart/">Оформить заказ</a>
//                                <a class="btn btn-border" href="javascript:PopUpHideCardadd()">Продолжить покупки</a>
//                            </div>
//                        </div>
//                    </div>
//                </div>
//                <a class="close-smg_boby" href="javascript:PopUpHideCardadd()"></a>
//            </div>
//        </div>';
//	return $message;
//}
//сообщение добавлено в корзину

//знак рубля
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
     switch( $currency ) {
          case 'RUB': $currency_symbol = ' руб'; break;
     }
     return $currency_symbol;
}
//знак рубля

//удалить поля оформления заказа
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_state']);
    unset($fields['billing']['billing_country']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_phone']);
    return $fields;
}
//удалить поля оформления заказа

// когда приходят письма в спам
wp_mail( $to, $subject, $message, $headers, '-info@mysite.com');
// когда приходят письма в спам

//WOOCOMMERCE
//WOOCOMMERCE
//WOOCOMMERCE

Хлебные крошки

<?php woocommerce_breadcrumb( $args ); ?>

LESS

//WOOCOMMERCE
//WOOCOMMERCE
//WOOCOMMERCE
.woocommerce{
    .woocommerce-message{
        margin-bottom: 50px;
        padding: 20px;
        background: #d4edd0;
        
        .button{
            vertical-align: middle;
            margin-right: 20px;
            
            @media (max-width: 1000px){
                display: block;
                margin-bottom: 20px;
            }
        }
    }
    ul{
        padding: 0;
        margin: 0;
    }
    .woocommerce-error{
        li{
            &::before{
                background: #eb8e8e;
            }
        }
    }
    
    abbr{
        border-bottom: none !important;
    }
    .order-total{
        color: #5daf6d;
    }
}

//таблица корзины
.shop_table{
    text-align: left;
    width: 100%;
    
    thead{
        @media (max-width: 900px){
            display: none;
        }
    }
    tr{
        border-bottom: 1px solid #c6c6c6;
        
        th, td{
            padding: 20px;
            
            &:first-child{
                padding-left: 0;
            }
            &:last-child{
                padding-right: 0;
            }
        }
        a{
            text-decoration: none;
        }
        .product-remove{
            a{
                color: #eb8e8e;
            }
        }
        .product-thumbnail{
            @media (max-width: 900px){
                display: none;
            }
            img{
                width: auto;
                height: 80px;
            }
        }
        .quantity{
            width: 100px;
            
            input{
                padding: 20px;
                width: 100%;
                text-align: center;
            }
        }
    }
    
    @media (max-width: 900px){
        .woocommerce-cart-form__cart-item{
            padding-bottom: 50px;
            display: block;
            border-bottom: none;
            
            th{
                display: none;
            }
            td{
                width: 100%;
                display: block;
                padding-left: 0;
                padding-right: 0;
                border-bottom: 1px solid #c6c6c6;
            }
            .product-name,
            .product-price,
            .product-quantity,
            .product-subtotal{
                &::before{
                    content: attr(data-title) ": ";
                    font-weight: bold;
                    float: left;
                }
                &::after{
                    content: "";
                    clear: both;
                    display: table;
                }
                .quantity,
                span,
                a{
                    float: right;
                }
            }
        }
    }
    
    
    .coupon{
        float: left;
        
        @media (max-width: 900px){
            float: none;
            margin-bottom: 40px;
        }
        label{
            display: none;
        }
        input{
            width: 40%;
            vertical-align: text-top;
            margin-right: 15px;
            
            @media (max-width: 900px){
                width: 100%;
                margin-right: 0;
                margin-bottom: 15px;
            }
        }
        .btn{
            vertical-align: text-top;
            
            @media (max-width: 900px){
                width: 100%;
            }
        }
    }
    .button[name=update_cart]{
        float: right;
        
        @media (max-width: 900px){
            float: none;
            width: 100%;
        }
    }
}
//таблица корзины

//таблица под корзиной
.cart-collaterals{
    padding-right: 50%;
    margin-top: 100px;
    
    @media (max-width: 1000px){
        padding-right: 0;
    }
    .wc-proceed-to-checkout{
        margin-top: 50px;
    }
    .button{
        @media (max-width: 900px){
            width: 100%;
        }
    }
}
//таблица под корзиной

//оформление заказа
form.woocommerce-checkout{
    width: 100%;
    flex-flow: row wrap;
    display: flex;
    display: -webkit-flex;
    -webkit-flex-flow: row wrap;
    display: -ms-flexbox;
    -ms-flex-flow: row wrap;
    -ms-align-content: flex-start;
    -webkit-align-content: flex-start;
    align-content: flex-start;
    list-style: none;
    
    .woocommerce-billing-fields h3,
    #order_review_heading{
        display: none;
    }
    .col2-set{
        width: calc(~'60% - 50px');
        margin-right: 100px;
        
        @media (max-width: 1000px){
            width: 100%;
            margin-right: 0;
            margin-bottom: 50px;
        }
        .form-row{
            margin-bottom: 20px;
            
            &:last-child{
                margin-bottom: 0;
            }
            .woocommerce-input-wrapper{
                display: block;
            }
        }
        select,
        textarea,
        input{
            width: 100%;
        }
    }
    .woocommerce-checkout-review-order{
        width: calc(~'40% - 50px');
        padding: 40px;
        background: @bg;
        box-sizing: border-box;
        
        @media (max-width: 1000px){
            width: 100%;
            padding: 40px 20px;
        }
        .wc_payment_methods{
            margin-top: 40px;
            display: none;
        }
        .woocommerce-privacy-policy-text{
            margin-top: 40px;
            
            p{
                font-size: 12px;
                line-height: 18px;
            }
        }
        .button{
            @media (max-width: 1000px){
                width: 100%;
            }
        }
    }
    
}
//оформление заказа

//заказ оформлен
.woocommerce-order{
    .woocommerce-thankyou-order-received{
        text-align: center;
        font-weight: bold;
        color: #5daf6d;
        font-size: 30px;
        margin-bottom: 40px;
    }
    .woocommerce-order-overview{
        padding: 40px;
        background: @bg;
    }
    section{
        padding: 40px;
        background: @bg;
        margin-top: 50px;
    }
    h2{
        margin-top: 0;
    }
    address{
        font-style: normal;
        
        p{
            margin-bottom: 0;
            margin-top: 15px;
        }
    }
}
//заказ оформлен

//хлебные крошки
.woocommerce-breadcrumb{
    margin-top: 40px;
    color: #8a8a8a;
    
    a{
        display: inline-block;
        margin-right: 10px;
        margin-left: 10px;
        color: @text;
        
        &:hover{
            color: @color-1;
        }
    }
}
//хлебные крошки


//WOOCOMMERCE
//WOOCOMMERCE
//WOOCOMMERCE
Контакты

Работаем: с ПН по ПТ, с 08:00 до 17:00 (МСК)
Отдыхаем: в СБ и ВС, чтобы быть в тонусе
и реализовывать самые сложные идеи