How to display the amount of products items in on-hold orders instead of in proccessing orders?
add_filter( 'aow_orders', 'aow_order_status' );
function aow_order_status( $args ) {
$args['status'] = 'on-hold';
return $args;
}
Popups
Install the plugin.
In WooCommerce notify the customer product page about discount ineligibility since purchase not enough items from it- add the Auto Open trigger, targeting the desired product id page, and the custom conditions (update the product id and the quantity for discount):
add_filter( 'pum_get_conditions', 'aow_pum_cart_product_quantity_conditions' );
function aow_pum_cart_product_quantity_conditions( $conditions ) {
return array_merge( $conditions, [
'password_page_unlocked' => [
'group' => __( 'Products', 'woocommerce' ),
'name' => __( 'Products', 'woocommerce' ) . ': ' . __( 'Cart', 'woocommerce' ) . ' ' . __( 'Quantity', 'woocommerce' ),
'callback' => 'aow_cart_product_quantity',
]
] );
}
function aow_cart_product_quantity() {
foreach ( WC()->cart->get_cart() as $cart_item ) {
if ( '772' === $cart_item['product_id'] && 3 > $cart_item['quantity'] ) {
return true;
}
}
return false;
}
In WooCommerce update the customer while purchase temporary out of stock product (for simple products):
- Enable the “Add To Cart button classes” and “Shortcodes” options in the Advanced Options plugin
- Create popup with the name
simple_is_on_backorder1
, targeting All Products - In the content insert the
[current_add_to_cart]
shortcode and notification about that he gonna add product which is temporary out of stock - If AJAX archive page option is enabled create another popup with trigger Click Open on
.archive_is_on_backorder1
and the option “do not prevent…” and notification about that he just added product which is temporary out of stock, if not use the code:
add_filter( 'woocommerce_loop_add_to_cart_args', 'aow_add_class', 10, 2 );
function aow_add_class( $args, $product ) {
if ( $product->is_type( 'simple' ) && $product->is_on_backorder() && ! is_product() && 'no' === get_option( 'woocommerce_enable_ajax_add_to_cart' ) ) {
$product_id = $product->get_id();
$args['class'] .= ' popmake-archive_backorder-' . $product_id;
$out = isset( $product->get_availability()['availability'] ) ? '<div>' . $product->get_availability()['availability'] . '</div>' . '<a href=' . $product->add_to_cart_url() . '>' . $product->add_to_cart_text() . '</a>' : '';
echo do_shortcode( "[popup id='archive_backorder-" . $product_id . "']" . $out . "[/popup]" );
}
return $args;
}