0

I created a custom order status, but when I assign an order to it, it makes downloadable products not accessible in a customers account. The minute I switch back to 'Completed' it works. Is there anyway to have a custom order status that will enable downloadable products?

// Add custom status to order list
add_action( 'init', 'register_custom_post_status', 10 );
function register_custom_post_status() {
    register_post_status( 'wc-accounting', array(
        'label'                     => _x( 'Accounting Complete', 'Order status', 'woocommerce' ),
        'public'                    => false,
        'exclude_from_search'       => false,
        'show_in_admin_status_list' => true,
        'show_in_admin_all_list'    => true,
        'label_count'               => _n_noop( 'Accounting Complete <span class="count">(%s)</span>', 'Shipped but not paid <span class="count">(%s)</span>' )
    ) );
}

// Add custom status to order edit page drop down (and displaying orders with this custom status in the list)
add_filter( 'wc_order_statuses', 'custom_wc_order_statuses' );
function custom_wc_order_statuses( $order_statuses ) {
    $order_statuses['wc-accounting'] = _x( 'Accounting Complete', 'Order status', 'woocommerce' );
    return $order_statuses;
}

// Adding custom status  to admin order list bulk actions dropdown

add_filter( 'bulk_actions-edit-shop_order', 'custom_dropdown_bulk_actions_shop_order', 20, 1 );
function custom_dropdown_bulk_actions_shop_order( $actions ) {
    $actions['mark_accounting'] = __( 'Mark Accounting Compelted', 'woocommerce' );
    return $actions;
}
  • i found this additional piece of code, but it still does give me access to the downloads. add_filter( 'woocommerce_valid_order_statuses_for_payment_complete', 'custom_status_valid_for_payment', 10, 2 ); function custom_status_valid_for_payment( $statuses, $order ) { // Registering the custom status as valid for payment $statuses[] = 'wc-accounting'; return $statuses; } – DEM Feb 12 at 3:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.