Woocommerce İçin 25 İpucu ve Püf Noktası
Woocommerce İçin 25 İpucu ve Püf Noktası
WordPress e-ticaret site sahipleri için Woocommerce ipuçları ve püf noktalarını liste halinde sıraladım. Aslında burada listelediğim ipuçları ve püf noklarının çoğu destek konusunda bana ulaşan woocommerce kullanıcılarından gelenler diyebilirim. Umarım işine yarayacak bilgiler bulabilirsiniz.
Önemli: Aşağıdaki düzenlemelerden herhangi birini uygulamadan önce yedeklerinizi alınız.
Woocommerce İçin 25 İpucu ve Püf Noktası
Orderby alanını kaldırmak mı istiyorsunuz?
Kodu functions.php dosyasına ekleyiniz.
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
Yorum tabını kaldırmak ve sadece ürün açıklaması tabının kalmasını isterseniz, style dosyanıza ekleyiniz.
.woocommerce .woocommerce-tabs ul.tabs {display:none !important}
Ürünleriniz için ürün video tabı isterseniz güzel bir eklenti: WooCommerce ürün video tabı
Toplu alımlarda indirim uygulamak istemezmisiniz
Toplu ürün alımlarında sepet sayfasında indirim uygulayabileceğiniz güzel bir eklenti: WooCommerce Bulk Discount
Satmadığınız ürünleri gizleyin
Mağazanıza girdiğiniz ama şuan satışa sunmak istemediğiniz ürünleri gizleyebilirsiniz, silmenize gerek yok.
Ürün açıklama tabını çoğaltabilirsiniz.
Kodu functions.php dosyasına ekleyiniz.
add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 );
function woo_custom_description_tab( $tabs ) {
$tabs['description']['callback'] = 'woo_custom_description_tab_content'; // Custom description callback
return $tabs;
}
Woocommerce İçin 25 İpucu ve Püf Noktası
İstemediğiniz ürün kategorilerini mağaza sayfasında göstermeyin
Kodu functions.php dosyasına ekleyiniz.
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() ) {
$q->set( 'tax_query', array(array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'PUT YOUR CATEGORY HERE' ), // Don't display products in the membership category on the shop page . For multiple category , separate it with comma.
'operator' => 'NOT IN'
)));
}
remove_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
}
Benzer ürünlerin kaç kolonda kaç adet listeleneceğini belirleyin
functions.php dosyasına ekleyiniz.
// Redefine woocommerce_output_related_products()
function woocommerce_output_related_products() {
woocommerce_related_products(4,2); // Display 4 products in rows of 2
}
Ürün kategorileri yanındaki ürün sayılarını kaldırabilirsiniz.
style.css dosyasına ekleyiniz.
.count {display:none !important}
Ödemesi alınan siparişleri otomatik onaylayın
Ödeme işlemi başarılı olan siparişlerin otomatik olarak onaylanması için functions.php dosyasına ekleyiniz.
/**
* Auto Complete all WooCommerce orders.
* Add to theme functions.php file
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
global $woocommerce;
if ( !$order_id )
return;
$order = new WC_Order( $order_id );
$order->update_status( 'completed' );
}
Woocommerce İçin 25 İpucu ve Püf Noktası
Ürün detay sayfasında sepete ekle yazısını değiştirin
kodu functions dosyası ekleyiniz
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
Mağaza sayfasında sepete ekle yazısını değiştirin
kodu functions dosyası ekleyiniz
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
Checkout sayfasını geliştirmek mi istiyorsunuz?
Bu eklenti fazlasıyla işinizi görecektir: WooCommerce Checkout Manager
Woocommerce breadcrumbs kaldırmak
add_action( 'init', 'jk_remove_wc_breadcrumbs' );
function jk_remove_wc_breadcrumbs() {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}
Woocommerce İçin 25 İpucu ve Püf Noktası
Menü barında sepeti göstermek
Basit bir eklenti ile menü barında sepet bilgilerini gösterebilirsiniz. WooCommerce Menu Cart
Para birimi sembolünü değiştirmek için functions dosyasına ekleyiniz ve kendinize göre düzenleyiniz..
add_filter( 'woocommerce_currencies', 'add_my_currency' );
function add_my_currency( $currencies ) {
$currencies['ABC'] = __( '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 'ABC': $currency_symbol = '$'; break;
}
return $currency_symbol;
}
Stokta yok yazısını istediğiniz yazı ile değiştirin
add_filter('woocommerce_get_availability', 'availability_filter_func');
function availability_filter_func($availability)
{
$availability['availability'] = str_ireplace('Out of stock', 'Sold', $availability['availability']);
return $availability;
}
Woocommerce İçin 25 İpucu ve Püf Noktası
Funtions dosyasına ekleyeceğiniz bu kod ile mağaza sayfasında ürün listelemelerini fiyata, tarihe ve isme göre otomatik olarak yapabilirsiniz.
add_filter('woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby');
function custom_default_catalog_orderby() {
return 'date'; // Can also use title and price
}
Mağaza sayfasında ürün kolon sayısını belirleyin
* WooCommerce Extra Feature
* --------------------------
*
* Change product columns number on shop pages
*
*/
function woo_product_columns_frontend() {
global $woocommerce;
// Default Value also used for categories and sub_categories
$columns = 4;
// Product List
if ( is_product_category() ) :
$columns = 4;
endif;
//Related Products
if ( is_product() ) :
$columns = 2;
endif;
//Cross Sells
if ( is_checkout() ) :
$columns = 4;
endif;
return $columns;
}
add_filter('loop_shop_columns', 'woo_product_columns_frontend');
Ücretsiz kargo aktif ise diğer kargo seçeneklerini gizleyin
/**
* woocommerce_package_rates is a 2.1+ hook
*/
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
/**
* Hide shipping rates when free shipping is available
*
* @param array $rates Array of rates found for the package
* @param array $package The package array/object being shipped
* @return array of modified rates
*/
function hide_shipping_when_free_is_available( $rates, $package ) {
// Only modify rates if free_shipping is present
if ( isset( $rates['free_shipping'] ) ) {
// To unset a single rate/method, do the following. This example unsets flat_rate shipping
unset( $rates['flat_rate'] );
// To unset all methods except for free_shipping, do the following
$free_shipping = $rates['free_shipping'];
$rates = array();
$rates['free_shipping'] = $free_shipping;
}
return $rates;
}
Woocommerce İçin 25 İpucu ve Püf Noktası
Anasayfada breadcrumbs gizlemek için style dosyasına ekletiniz.
.home .breadcrumb { display:none; }
Kategori sayfasında kategori resmini gösterme
add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 );
function woocommerce_category_image() {
if ( is_product_category() ){
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
if ( $image ) {
echo '
';
}
}
}
Ürün resimlerine zoom efekti vermek isterseniz şu eklentiyi kullanabilrisiniz: YITH WooCommerce Zoom Magnifier
İndirim etiketlerinde indirim oranını yüzde olarak gösterin