Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #3824943
Product in stead of variations
Open

Comments

  •  2
    Martijn Chel started the conversation

    Hello, thanks for a great plugin.

    Just one question; we have a lot of products with many variations. Like legging XXL, XL, L, M, S, etc. To show these on sale as separate items might not be tempting for viewers to click on when it’s not their size. So, they might ignore it while the other sizes are also on offer, but they don’t see that. Is there a way to show the main product in the notifications and not all the variations of it?

    Thank you!


    Ps I don't have the premium version of this plugin but I did buy product bundles (YVSPORT email) and timer. I hope you can still help.

  •  1,355
    Dustin replied

    Hi Martijn,

    Please update our plugin to version 2.4.2, then add the custom code below. (How to add custom code? ↗):

    add_filter( 'WPCSN/item_product', function ( $product ) {
    	if ( is_a( $product, 'WC_Product_Variation' ) ) {
    		$parent_id = $product->get_parent_id();
    		$product   = wc_get_product( $parent_id );
    	}
    
    	return $product;
    } );

    Let me know if it works as you expected.

    Best regards,
    Dustin

  •  2
    Martijn Chel replied

    Thank you. That works great.

    Only I noticed that it doesn't include the offers (sale items) from your product bundle plugin that I bought. Any reason why? And could those cheaper bundles be added?

  •  1,355
    Dustin replied

    Please follow these steps:

    #1. Install an updated version 2.4.2.1 here https://www.dropbox.com/scl/fi/pm2vtudesc14gsn1n8u4b/wpc-smart-notification-2421.zip?rlkey=0zhcdyegyc8qr0428rjwle91k&dl=1

    #2. Add the custom code below. (How to add custom code? ↗):

    add_filter( 'WPCSN/on_sale_products', function ( $ids ) {
    	if ( class_exists( 'WPCleverWoosb' ) ) {
    		if ( false === ( $bundles_on_sale = get_transient( 'woosb_bundles_on_sale' ) ) ) {
    			$bundles_on_sale = [];
    			$bundles         = new WP_Query( [
    				'post_type'      => 'product',
    				'post_status'    => 'publish',
    				'posts_per_page' => 50,
    				'tax_query'      => [
    					[
    						'taxonomy' => 'product_type',
    						'field'    => 'slug',
    						'terms'    => [ 'woosb' ],
    						'operator' => 'IN',
    					]
    				],
    			] );
    
    			if ( $bundles->have_posts() ) {
    				while ( $bundles->have_posts() ) {
    					$bundles->the_post();
    					$bundle = wc_get_product( get_the_ID() );
    
    					if ( $bundle && $bundle->is_on_sale() ) {
    						$bundles_on_sale[] = $bundle->get_id();
    					}
    				}
    
    				wp_reset_query();
    			}
    
    			set_transient( 'woosb_bundles_on_sale', $bundles_on_sale, 24 * HOUR_IN_SECONDS );
    		}
    
    		return array_merge( $bundles_on_sale, $ids );
    	}
    
    	return $ids;
    } );

    The list of bundles being sold will be cached for a day, so your website doesn't have to process too much.

    Best regards,
    Dustin

  •  2
    Martijn Chel replied

    Perfect, thank you for the support!

  •  1,355
    Dustin replied

    You're welcome! 

    If you're pleased with WPC Product Bundles, please consider giving it a full five-star ★★★★★ rating. 
    https://wordpress.org/support/plugin/woo-product-bundle/reviews?rate=5#new-post 
    I appreciate any help you can provide. ♥

    Best regards,
    Dustin