This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_get_availability', 'my_woocommerce_get_availability' ); | |
function my_woocommerce_get_availability( $availability ) { | |
if ( $availability['class'] == 'available-on-backorder' ) { | |
$availability['availability'] = 'Под заказ'; | |
} | |
return $availability; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Автообновление корзины | |
add_action( 'wp_print_footer_scripts', 'auto_update_cart' ); | |
function auto_update_cart(){ | |
?> | |
<script type="text/javascript"> | |
jQuery( function( $ ) { | |
$( 'body' ).on( 'change', '.qty', function() { // поле с количеством имеет класс .qty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add to cart | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'tb_woo_custom_cart_button_text' ); | |
add_filter( 'woocommerce_product_add_to_cart_text', 'tb_woo_custom_cart_button_text' ); | |
function tb_woo_custom_cart_button_text() { | |
return __( 'Положить товар в Корзину', 'woocommerce' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Добавляем значение скидки рядом с ценой у товаров (в рублях / в процентах ) | |
add_action( 'woocommerce_single_product_summary', 'usota_single_on_sale', 10 ); | |
function usota_single_on_sale() { | |
global $product; | |
if ( $product->is_on_sale() ) { | |
// Экономия в процентах | |
//$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('term_link', 'truemisha_ne_sbrasyvat_filtr', 10, 3); | |
function truemisha_ne_sbrasyvat_filtr( $url, $term, $taxonomy ) { | |
// сначала мы проверяем, присутствует у нас в данный момент сортировка | |
$orderby = ! empty( $_GET[ 'orderby' ] ) ? $_GET[ 'orderby' ] : ''; | |
// если присутствует, то добавляем её в конечный урл | |
if( $orderby ) { | |
return add_query_arg( 'orderby', $orderby, $url ); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* ========== Header ========== */ | |
/* Storefront: включить/отключить/поменять местами блоки в шапке | Header element move */ | |
add_action('init', 'remove_storefront_header_search_init'); | |
function remove_storefront_header_search_init() { | |
remove_action('storefront_header', 'storefront_site_branding', 20); // Логотип | |
remove_action('storefront_header', 'storefront_secondary_navigation', 30); // Дополнительное меню | |
remove_action('storefront_header', 'storefront_product_search', 40); // Поиск | |
remove_action('storefront_header', 'storefront_primary_navigation', 50); // Основное меню |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Пиксель FB должен быть обяательно установлен | |
//.button_class — класс кнопки, нажатие которой нужно отследить | |
// Пождробнее на https://developers.facebook.com/docs/facebook-pixel/advanced | |
<script> | |
jQuery(document).ready(function () { | |
jQuery('.button_class').click(function () { | |
fbq('track', 'CompleteRegistratipn'); | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function disable_shipping_calc_on_cart( $show_shipping ) { | |
if( is_cart() ) { | |
return false; | |
} | |
return $show_shipping; | |
} | |
add_filter( 'woocommerce_cart_ready_to_calc_shipping', 'disable_shipping_calc_on_cart', 99 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_default_catalog_orderby_options', 'truemisha_remove_orderby_options' ); | |
add_filter( 'woocommerce_catalog_orderby', 'truemisha_remove_orderby_options' ); | |
function truemisha_remove_orderby_options( $sortby ) { | |
unset( $sortby[ 'popularity' ] ); // по популярности | |
unset( $sortby[ 'rating' ] ); // по рейтингу | |
unset( $sortby[ 'date' ] ); // Сортировка по более позднему |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Добавить сортировку «В случайном порядке» | |
add_filter( 'woocommerce_default_catalog_orderby_options', 'truemisha_custom_orderby_option' ); | |
add_filter( 'woocommerce_catalog_orderby', 'truemisha_custom_orderby_option' ); | |
function truemisha_custom_orderby_option( $sortby ) { | |
$sortby['randomly'] = 'В случайном порядке'; | |
return $sortby; | |
} |