Categories
WordPress

WordPress Popups

And the Jazz Artists.

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', 'condless_pum_cart_product_quantity_conditions' );
function condless_pum_cart_product_quantity_conditions( $conditions ) {
        return array_merge( $conditions, array(
                'password_page_unlocked' => array(
                        'group'    => __( 'Products', 'woocommerce' ),
                        'name'     => __( 'Products', 'woocommerce' ) . ': ' . __( 'Cart', 'woocommerce' ) . ' ' . __( 'Quantity', 'woocommerce' ),
                        'callback' => 'cart_product_quantity',
                ),
        ) );
}
function 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 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', 'condless_add_class', 10, 2 );
function condless_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;
		if ( isset( $product->get_availability()['availability'] ) ) $out = '<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;
}

As you probably have noticed- Pastorius, Carter, Vald├ęs, and all other WordPress Version names, are names of popular jazz artists, inspired by WordPress core developers, who share a love of jazz music.

Leave a Reply

Your email address will not be published. Required fields are marked *