Woocommerce Rechnungen Kundenkonto

Dieser Code bietet den Kunden die Einsicht in Ihre Rechnungen im Kundenkonto.

add_filter( 'woocommerce_my_account_my_orders_actions', 'german_market_woocommerce_my_account_my_orders_actions', 10, 2 );

/**
 * Add Download Invoice PDF Button to my-account page
 *
 * @wp-hook woocommerce_my_account_my_orders_actions
 * @param	Array $actions
 * @param 	WC_Order $order
 * @return 	Array
 */
function german_market_woocommerce_my_account_my_orders_actions( $actions, $order ) {

	$status 	= $order->get_status();

	if ( ( $status !== false ) && ( get_option( 'wp_wc_invoice_pdf_frontend_download_' . $status, 'no' ) == 'yes' ) ) {		

		$actions[ 'invoice' ] = array(

			'url' 	=> esc_url( wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_wp_wc_invoice_pdf_view_order_invoice_download&order_id=' . $order->get_id() ), 'wp-wc-invoice-pdf-download' ) ),
			'name' 	=> get_option( 'wp_wc_invoice_pdf_view_order_button_text', __( 'Download Invoice Pdf', 'woocommerce-german-market' ) ),

		);

	}

	return $actions;
}

Für alle snippets benutzen wir das Plugin code snippet.

Woocommerce Checkout Felder entfernen

Entfernen von Warenkorb Checkout Felder

/**
 * WooCommerce - Checkout-Felder entfernen
 */

add_filter( 'woocommerce_checkout_fields' , 'wp_bibel_de_remove_checkout_fields' );

function wp_bibel_de_remove_checkout_fields( $fields ) {
	unset($fields['billing']['billing_first_name']);
	unset($fields['billing']['billing_last_name']);
/*
	unset($fields['billing']['billing_company']);
	unset($fields['billing']['billing_address_1']);
	unset($fields['billing']['billing_address_2']);
	unset($fields['billing']['billing_city']);
	unset($fields['billing']['billing_postcode']);
	unset($fields['billing']['billing_country']);
	unset($fields['billing']['billing_state']);
	unset($fields['billing']['billing_email']);
	unset($fields['billing']['billing_phone']);
*/	
	unset($fields['shipping']['shipping_first_name']);
	unset($fields['shipping']['shipping_last_name']);
/*
	unset($fields['shipping']['shipping_company']);
	unset($fields['shipping']['shipping_address_1']);
	unset($fields['shipping']['shipping_address_2']);
	unset($fields['shipping']['shipping_city']);
	unset($fields['shipping']['shipping_postcode']);
	unset($fields['shipping']['shipping_country']);
	unset($fields['shipping']['shipping_state']);
	
	unset($fields['account']['account_username']);
	unset($fields['account']['account_password']);
	unset($fields['account']['account_password-2']);
	
	unset($fields['order']['order_comments']);
*/

	return $fields;
}

Für alle snippets benutzen wir das Plugin code snippet.

Woocommerce Checkout Felder umbenennen

Umbenennen der Warenkorb Checkout Felder

/**
 * WooCommerce - Checkout-Felder umbenennen
 */

add_filter( 'woocommerce_checkout_fields' , 'wp_bibel_de_rename_checkout_fields' );

function wp_bibel_de_rename_checkout_fields( $fields ) {
	$fields['billing']['billing_company']['label'] = 'Name, Vorname oder Firma eingeben';
	$fields['billing']['billing_company']['placeholder'] = 'Name, Vorname oder Firma eingeben';

	return $fields;
}

Für alle snippets benutzen wir das Plugin code snippet.

Woocommerce Bestellstatus Lieferrückstand

Neuer Bestellstatus Lieferrückstand

Manchmal braucht es einfach einen weitere Bestellstatus, Gründe dafür kann es viele geben. WIr haben z.B. einen neuen Bestellstatus „In Lieferrückstand“ eingefügt, weil wir bei einigen Produkten eine Bestellung trotz ausverkauftem Lagerbestand erlauben. Damit wir dann nicht den Überblick verlieren, wir die Bestellung einfach in den neuen Bestellstaus geschoben.

//Neuer Bestellstatus Lieferrückstand
function register_shipment_arrival_order_status() {
    register_post_status( 'wc-arrival-shipment', array(
        'label'                     => 'In Lieferrückstand',
        'public'                    => true,
        'show_in_admin_status_list' => true,
        'show_in_admin_all_list'    => true,
        'exclude_from_search'       => false,
        'label_count'               => _n_noop( 'In Lieferrückstand <span class="count">(%s)</span>', 'In Lieferrückstand <span class="count">(%s)</span>' )
    ) );
}
add_action( 'init', 'register_shipment_arrival_order_status' );
 
function add_awaiting_shipment_to_order_statuses( $order_statuses ) {
 
    $new_order_statuses = array();
 
    foreach ( $order_statuses as $key => $status ) {
 
        $new_order_statuses[ $key ] = $status;
 
        if ( 'wc-processing' === $key ) {
            $new_order_statuses['wc-arrival-shipment'] = 'In Lieferrückstand';
        }
    }
 
    return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'add_awaiting_shipment_to_order_statuses' );

Für alle snippets benutzen wir das Plugin code snippet.

Woocommerce Anzahl der Verkäufe anzeigen

Gesamtzahl der Verkäufe anzeigen in der Produkt Übersicht

add_filter( 'manage_edit-product_columns', 'bdev_add_total_sales_to_product_list', 20 );
add_action( 'manage_posts_custom_column', 'bdev_display_total_sales_in_product_list' );
add_filter('manage_edit-product_sortable_columns', 'bdev_sort_total_sales_product_list');
add_action( 'pre_get_posts', 'bdev_total_sales_query_product_list' );
 
function bdev_add_total_sales_to_product_list( $col_th ) {
    return wp_parse_args( array( 'total_sales' => 'Total Sales' ), $col_th );
}
 
function bdev_display_total_sales_in_product_list( $column_id ) {
    if( $column_id  == 'total_sales' )
        echo get_post_meta( get_the_ID(), 'total_sales', true );
}
 
function bdev_sort_total_sales_product_list( $a ){
    return wp_parse_args( array( 'total_sales' => 'by_total_sales' ), $a );
}
 
function bdev_total_sales_query_product_list( $query ) {
    if( !is_admin() || empty( $_GET['orderby']) || empty( $_GET['order'] ) )
        return;
 
    if( $_GET['orderby'] == 'by_total_sales' ) {
        $query->set('meta_key', 'total_sales' );
        $query->set('orderby', 'meta_value_num');
        $query->set('order', $_GET['order'] );
    }
 
    return $query;
 
}

Für alle snippets benutzen wir das Plugin code snippet.