Skip to content

Instantly share code, notes, and snippets.

@eminozlem
Last active March 1, 2021 17:13
Show Gist options
  • Save eminozlem/65a7146b6b16e6774fb1 to your computer and use it in GitHub Desktop.
Save eminozlem/65a7146b6b16e6774fb1 to your computer and use it in GitHub Desktop.
Woocommerce yeni sipariş durumu ekleme örn: kargolandı
/** Yeni durumu kayıt et **/
function hp_kargolandi_status_register() {
register_post_status( 'wc-kargolandi', array(
'label' => 'Kargolanmış',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Kargolanmış <span class="count">(%s)</span>', 'Kargolanmış <span class="count">(%s)</span>' )
) );
}
add_action( 'init', 'hp_kargolandi_status_register' );
// Add to list of WC Order statuses
function hp_add_kargolandi_status( $order_statuses ) {
$new_order_statuses = array();
// add new order status after processing
foreach ( $order_statuses as $key => $status ) {
$new_order_statuses[ $key ] = $status;
if ( 'wc-processing' === $key ) {
$new_order_statuses['wc-kargolandi'] = 'Kargolandı';
}
}
return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'hp_add_kargolandi_status' );
/* https://github.com/woothemes/woocommerce-icons/blob/master/demo.html */
add_action('admin_head', 'kargolandi_icon');
function kargolandi_icon() {
echo '<style>
.widefat .column-order_status mark.kargolandi::after {
font-family: WooCommerce;
font-variant: normal;
font-weight: 400;
height: 100%;
left: 0;
line-height: 1;
margin: 0;
position: absolute;
text-align: center;
text-indent: 0;
text-transform: none;
top: 0;
width: 100%;
content: "\e019";
color: #333;
}
</style>';
}
@ahmettbozyel
Copy link

Merhabalar
Şipariş durumları ve epostaları çok karışık.... Siz bu konuda uzmansınız sanırım. Kredi kartı ile ödeme ve kapıda ödeme gibi durumlarda sipariş iptali ve başarısız ödeme gibi epostalar iletilmiyor. bunun bir sebebi var mı?

@ozzhan
Copy link

ozzhan commented Dec 22, 2020

Merhaba ben kodunuzu kullandım ve çalışıyor. yalnız aynı zamanda bu kargolandı dedikten sonra eylem bölümünden de kargonuz şu kargo ile yola çıkmıştır diye mail attırmak için ne yapmam lazım ?

@eminozlem
Copy link
Author

Mail tanımlama kısmı biraz daha karışık mail template filan atamak lazım o aşamada artık "order status manager" gibi bi eklenti kullanmak daha mantıklı

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment