/** * Enqueue script and styles for child theme */ function woodmart_child_enqueue_styles() { wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'woodmart-style' ), woodmart_get_theme_info( 'Version' ) ); } add_action( 'wp_enqueue_scripts', 'woodmart_child_enqueue_styles', 10010 ); add_filter('woocommerce_currency_symbol','change_uah_currency_symbol',10,2); function change_uah_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) {case'UAH':$currency_symbol='грн.'; break;} return $currency_symbol; } add_filter( 'wc_order_is_editable', 'lets_make_processing_orders_editable', 10, 2 ); function lets_make_processing_orders_editable( $is_editable, $order ) { if ( $order->get_status() == 'processing' ) { $is_editable = true; } return $is_editable; } /* УБРАТЬ ОБЯЗАТЕЛЬНОЕ ЗАПОЛНЕНИЕ ПОЧТЫ */ add_filter( 'woocommerce_checkout_fields' , 'misha_not_required_fields', 9999 ); function misha_not_required_fields( $f ) { unset( $f['billing']['billing_email']['required'] ); // that's it // the same way you can make any field required, example: // $f['billing']['billing_company']['required'] = true; return $f; } /* Telsender add action*/ function meta_wc_function ($list, $order_id){ $order = wc_get_order( $order_id); $items = $order->get_items(); $product_f = ''; foreach ( $items as $item) { $product_item = $item->get_product(); if ($product_item) { $meta_data = ''; foreach($item->get_meta_data() as $k=>$value){ $meta_data .= $value->key .': '.$value->value.''.chr(10); } $option = $product_item->get_data(); $sku = $product_item->get_sku(); $product_f .='Товар: '.$item['name'].' X '.$item['quantity'].' шт.'.chr(10) .''.$meta_data.'' .'Цена: '.$item['total'].' грн.'.chr(10).chr(10); } } $list['{product_f}'] = $product_f; return $list; } add_filter( 'tscf_filter_codetemplate','meta_wc_function', 20, 2 ); /* fee_total Telsender */ function telsender_fee_total($list, $order_id){ // (optional if not defined) An instance of the WC_Order object $the_order = wc_get_order( $order_id ); $fee_total = 0; // Iterating through order fee items ONLY foreach( $the_order->get_items('fee') as $item_id => $item_fee ){ // The fee name $fee_name = $item_fee->get_name(); // The fee total amount $fee_total += $item_fee->get_total(); // The fee total tax amount $fee_total_tax = $item_fee->get_total_tax(); } $list['{fee_total}'] = $fee_total ; return $list; } add_filter( 'tscf_filter_codetemplate','telsender_fee_total', 20, 2 ); /** * Telsender coupons name * @param $list * @param $order_id * @return mixed */ function telsender_coupons($list, $order_id){ // (optional if not defined) An instance of the WC_Order object $order = wc_get_order( $order_id ); $coupons = $order->get_coupon_codes(); $coupon_line = implode(' | ', $coupons); $list['{coupons}'] = $coupon_line; return $list; } add_filter( 'tscf_filter_codetemplate','telsender_coupons', 20, 2 ); /** * * The framework's functions and definitions */ /** * ------------------------------------------------------------------------------------------------ * Define constants. * ------------------------------------------------------------------------------------------------ */ update_option( 'woodmart_is_activated', '1' ); use Elementor\Utils; define( 'WOODMART_THEME_DIR', get_template_directory_uri() ); define( 'WOODMART_THEMEROOT', get_template_directory() ); define( 'WOODMART_IMAGES', WOODMART_THEME_DIR . '/images' ); define( 'WOODMART_SCRIPTS', WOODMART_THEME_DIR . '/js' ); define( 'WOODMART_STYLES', WOODMART_THEME_DIR . '/css' ); define( 'WOODMART_FRAMEWORK', '/inc' ); define( 'WOODMART_DUMMY', WOODMART_THEME_DIR . '/inc/dummy-content' ); define( 'WOODMART_CLASSES', WOODMART_THEMEROOT . '/inc/classes' ); define( 'WOODMART_CONFIGS', WOODMART_THEMEROOT . '/inc/configs' ); define( 'WOODMART_HEADER_BUILDER', WOODMART_THEME_DIR . '/inc/header-builder' ); define( 'WOODMART_ASSETS', WOODMART_THEME_DIR . '/inc/admin/assets' ); define( 'WOODMART_ASSETS_IMAGES', WOODMART_ASSETS . '/images' ); define( 'WOODMART_API_URL', 'https://xtemos.com/licenses/api/' ); define( 'WOODMART_DEMO_URL', 'https://woodmart.xtemos.com/' ); define( 'WOODMART_PLUGINS_URL', WOODMART_DEMO_URL . 'plugins/' ); define( 'WOODMART_DUMMY_URL', WOODMART_DEMO_URL . 'dummy-content-new/' ); define( 'WOODMART_SLUG', 'woodmart' ); define( 'WOODMART_CORE_VERSION', '1.0.31' ); define( 'WOODMART_WPB_CSS_VERSION', '1.0.2' ); /** * ------------------------------------------------------------------------------------------------ * Load all CORE Classes and files * ------------------------------------------------------------------------------------------------ */ if ( ! function_exists( 'woodmart_load_classes' ) ) { function woodmart_load_classes() { $classes = array( 'Singleton.php', 'Ajaxresponse.php', 'Api.php', 'Googlefonts.php', 'Config.php', 'Cssparser.php', 'Layout.php', 'License.php', 'Notices.php', 'Options.php', 'Stylesstorage.php', 'Theme.php', 'Themesettingscss.php', 'Vctemplates.php', 'Wpbcssgenerator.php', 'Registry.php', 'Pagecssfiles.php', ); foreach ( $classes as $class ) { require WOODMART_CLASSES . DIRECTORY_SEPARATOR . $class; } } } woodmart_load_classes(); new WOODMART_Theme();