This file contains hidden or 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
if( ! function_exists( 'is_wc_gateway_ppec' ) ) { | |
function is_wc_gateway_ppec() { | |
return is_woocommerce_extension_activated( 'WC_GATEWAY_PPEC' ); | |
} | |
} | |
if ( ! function_exists( 'electro_header_mini_cart_icon' ) ) { | |
/** | |
* @since 2.0 | |
*/ |
This file contains hidden or 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 | |
$cur_queried_object = get_queried_object(); | |
/*======================================================== | |
* получить родительскую по названию и родительской term_id | |
========================================================*/ | |
$terms = get_terms( array( | |
'taxonomy' => array( 'category', ), // название таксономии с WP 4.5 | |
'child_of' => $department_term->term_id, | |
'name__like' => $cat_lvl2->subdivision, | |
) ); |
This file contains hidden or 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
// Добавляем поле описания в форму редактирования атрибута | |
add_action( 'woocommerce_after_add_attribute_fields', 'art_added_field_description', 20 ); | |
add_action( 'woocommerce_after_edit_attribute_fields', 'art_added_field_description', 20 ); | |
function art_added_field_description() { | |
$attribute_description = ''; | |
if ( ! empty( $_GET['edit'] ) ) { | |
$attribute_description = get_term_meta( $_GET['edit'], 'description', true ) ? : ''; | |
} |
This file contains hidden or 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 // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_filter( 'woocommerce_product_subcategories_args', 'custom_woocommerce_product_subcategories_args' ); | |
function custom_woocommerce_product_subcategories_args( $args ) { | |
$args['exclude'] = get_option( 'default_product_cat' ); | |
return $args; |
This file contains hidden or 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
function electro_template_single_add_to_cart() { | |
global $product; | |
$product_type = electro_wc_get_product_type( $product ); | |
if( electro_get_shop_catalog_mode() == false ) { | |
do_action( 'woocommerce_' . $product_type . '_add_to_cart' ); | |
} elseif( electro_get_shop_catalog_mode() == true && $product->is_type( 'external' ) ) { | |
do_action( 'woocommerce_' . $product_type . '_add_to_cart' ); | |
} elseif( electro_get_shop_catalog_mode() == true && $product->is_type( 'variable' ) ) { | |
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 ); |
This file contains hidden or 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
add_filter( 'comment_form_after_fields', 'add_consent_personal_data_comment' ); | |
function add_consent_personal_data_comment(){ | |
?> | |
<small style="font-size: 12px;line-height: 1.1;margin: 10px 0;display: block;"> Нажимая на кнопку отправить, я принимаю условия <a href="#" target="_blank">пользовательского соглашения</a> , а также ознакомлен и согласен с <a href="#" target="_blank">политикой конфиденциальности</a> и даю согласие на обработку моих персональных данных</small> | |
<?php | |
} |
This file contains hidden or 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
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
if ( ! class_exists( 'WC_Settings_MyPlugin' ) ) : | |
function my_plugin_add_settings() { | |
/** | |
* Settings class | |
* | |
* @since 1.0.0 | |
*/ | |
class WC_Settings_MyPlugin extends WC_Settings_Page { | |
This file contains hidden or 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
/** | |
* Руссифицирует месяца и недели в дате. | |
* Функция для фильтра date_i18n. | |
* @param строка $date Дата в принятом формате | |
* @param строка $req_format Формат передаваемой даты | |
* @return Дату в русском формате | |
*/ | |
function russify_months( $date, $req_format ){ | |
// в формате есть "строковые" неделя или месяц | |
if( ! preg_match('~[FMlSD]~', $req_format ) ) return $date; |
This file contains hidden or 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
/* Customize Product Categories Labels */ | |
add_filter( 'woocommerce_taxonomy_args_product_cat', 'custom_wc_taxonomy_args_product_cat' ); | |
function custom_wc_taxonomy_args_product_cat( $args ) { | |
$args['label'] = __( 'Product Categories', 'woocommerce' ); | |
$args['labels'] = array( | |
'name' => __( 'Product Categories', 'woocommerce' ), | |
'singular_name' => __( 'Product Category', 'woocommerce' ), | |
'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ), | |
'search_items' => __( 'Search Product Categories', 'woocommerce' ), | |
'all_items' => __( 'All Product Categories', 'woocommerce' ), |