
Woocommerce Variyasyonlu Fiyat Nasıl Kaldırılır?
3
●76
- 13-07-2020, 23:38:43Arkadaşlar Woocommerce ile variyasyonlu ürün ekliyorum ancak her iki variyasyonun da fiyatını gösteriyor.
Yukarıda görüldüğü gibi birinci variyasyon 100 ikinci variyasyon 500 tl örneğin ve ikisini de gösteriyor. Fakat ben sadece ilk variyasyonu göstersin ikinci variyasyonu seçene iki tıkladığında göstersin istiyorum.. Bunu nasıl yapabilirim?
- 13-07-2020, 23:42:12Her iki varyasyona da aynı fiyatı verebilirsiniz.
Edit: Pardon, ne demek istediğinizi şimdi anladım
Temanızın function.php dosyasının en altına bu kodları eklemeyi deneyebilirsiniz. Denemeden önce muhakkak yedek almanızı öneririm.
//Hide Price Range for WooCommerce Variable Products add_filter( 'woocommerce_variable_sale_price_html', 'lw_variable_product_price', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'lw_variable_product_price', 10, 2 ); function lw_variable_product_price( $v_price, $v_product ) { // Product Price $prod_prices = array( $v_product->get_variation_price( 'min', true ), $v_product->get_variation_price( 'max', true ) ); $prod_price = $prod_prices[0]!==$prod_prices[1] ? sprintf(__('From: %1$s', 'woocommerce'), wc_price( $prod_prices[0] ) ) : wc_price( $prod_prices[0] ); // Regular Price $regular_prices = array( $v_product->get_variation_regular_price( 'min', true ), $v_product->get_variation_regular_price( 'max', true ) ); sort( $regular_prices ); $regular_price = $regular_prices[0]!==$regular_prices[1] ? sprintf(__('From: %1$s','woocommerce') , wc_price( $regular_prices[0] ) ) : wc_price( $regular_prices[0] ); if ( $prod_price !== $regular_price ) { $prod_price = '<del>'.$regular_price.$v_product->get_price_suffix() . '</del> <ins>' . $prod_price . $v_product->get_price_suffix() . '</ins>'; } return $prod_price; } - 14-07-2020, 01:43:01
add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 );add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 );function wc_wc20_variation_price_format( $price, $product ) { // Main Price $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); $price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); // Sale Price $prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); sort( $prices ); $saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); if ( $price !== $saleprice ) { $price = '<del>' . $saleprice . '</del> <ins>' . $price . '</ins>'; } return $price;}functions.php ye ekleyin düşük fiyatlı ürünün fiyatını gösterir sadece. - 13-07-2020, 23:49:02Gutenberg adlı üyeden alıntı: mesajı görüntüleZimmeR adlı üyeden alıntı: mesajı görüntüle
deneyelim sağolun.. bu arada ikinizinde verdiği kodda woocommerce_variable_sale_price_html dosyası dikkatimi çekti öyle bir dosya yok ki.. önemsemeyeyim mi?