// Add custom Theme Functions here /*function run_me(){ $post = get_the_ID(); $youtubeID = get_post_meta($post,'_product_video',true); $piro_oszt = get_the_terms($_post,'pa_pirotechnikai-osztaly'); $piro_oszt = $piro_oszt[0]->name; switch($piro_oszt){ case '1': wp_set_object_terms( get_the_ID(), '14 év', 'pa_szukseges-eletkor', false); wp_set_object_terms( get_the_ID(), '1 méter', 'pa_minimalis-biztonsagi-tavolsa', false); break; case '2': wp_set_object_terms( get_the_ID(), '16 év', 'pa_szukseges-eletkor', false); wp_set_object_terms( get_the_ID(), '8 méter', 'pa_minimalis-biztonsagi-tavolsa', false); break; default: wp_set_object_terms( get_the_ID(), '18 év', 'pa_szukseges-eletkor', false); wp_set_object_terms( get_the_ID(), '15 méter', 'pa_minimalis-biztonsagi-tavolsa', false); break; } if($youtubeID){ $old =get_post_meta( get_the_ID(), 'wc_productdata_options'); $old['_product_video']=$youtubeID; update_post_meta( get_the_ID(), 'wc_productdata_options',$old); //wp_set_object_terms( get_the_ID(), '_product_video', $youtubeID, false); } // Now update the post with its new attributes //update_post_meta($id, '_material', $material); } add_action('wp_enqueue_scripts','run_me');*/ /*function run_me2(){ $youtubeID = get_post_meta($post,'_product_video',true); if($youtubeID){ $old =get_post_meta( get_the_ID(), 'wc_productdata_options'); $old['_product_video']=$youtubeID; update_post_meta( get_the_ID(), 'wc_productdata_options',$old); //wp_set_object_terms( get_the_ID(), '_product_video', $youtubeID, false); } } add_action('init','run_me2');*/ function render_product_description($item_id, $item, $order){ $_product = $order->get_product_from_item( $item ); // echo "
tesztelek" . $item->SKU; } add_action('woocommerce_order_item_meta_end', 'render_product_description',10,3); //Akciós Linkek function baztag_func( ) { $posttags = get_terms( 'product_tag'); if ($posttags) { echo ""; } } add_shortcode( 'baztag', 'baztag_func' ); add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 ); function woocommerce_custom_sales_price( $price, $product ) { $percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 ); return $price . sprintf( __(' Save %s', 'woocommerce' ), $percentage . '%' ); } function reduce_woocommerce_min_strength_requirement( $strength ) { return 1; } add_filter( 'woocommerce_min_password_strength', 'reduce_woocommerce_min_strength_requirement' ); add_action( 'wp_enqueue_scripts', 'my_strength_meter_localize_script' ); function my_strength_meter_localize_script() { wp_localize_script( 'password-strength-meter', 'pwsL10n', array( 'empty' => __( 'A jelszó mező üres!', 'flatsome' ), 'short' => __( 'Túl rövid', 'flatsome' ), 'bad' => __( 'Gyenge jelszó, de elfogadjuk', 'flatsome' ), 'good' => __( 'Erős jelszó', 'flatsome' ), 'strong' => __( 'Biztonságos jelszó', 'flatsome' ), 'mismatch' => __( 'A két jelszó eltér egymástól', 'flatsome' ) ) ); } add_filter('password_hint', 'change_password_hint'); function change_password_hint($hint) { return "Írj be erősebb jelszót!"; } add_filter('woocommerce_get_order_item_totals','change_discount',10,3); function change_discount($total_rows, $order, $tax_display){ if ( $order->get_total_discount() > 0 ) { $coupons = $order->get_used_coupons(); $total_rows['discount'] = array( 'label' => __( 'Kupon kód: '.implode(",",$coupons)."
", 'woocommerce' ), 'value' => '-' . $order->get_discount_to_display( $tax_display ), ); } return $total_rows; } add_filter( 'woocommerce_currencies', 'add_my_currency' ); function add_my_currency( $currencies ) { $currencies['PNT'] = __( 'Currency name', 'woocommerce' ); return $currencies; } add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2); function add_my_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'PNT': $currency_symbol = 'pont'; break; } return $currency_symbol; } //PONT DEVIZA function change_woocommerce_currency( $currency ) { global $post; $post_ID = $post->ID; $terms = wp_get_post_terms( $post->ID, 'product_cat' ); $categories = array(); foreach ( $terms as $term ){ $categories[] = $term->slug; } if ( in_array( 'pontokert-vasarolhato-termekek', $categories ) ) { $currency = "PNT"; // or whatever the currency symbol is } return $currency; } add_filter( 'woocommerce_currency', 'change_woocommerce_currency' ,10 ,1);/** * Flatsome functions and definitions * * @package flatsome */ require get_template_directory() . '/inc/init.php'; /** * Note: It's not recommended to add any custom code here. Please use a child theme so that your customizations aren't lost during updates. * Learn more here: http://codex.wordpress.org/Child_Themes */