Please advise how

Please advise how to deactivate Digital Download Order email notification when a new order is shipped?

My shop selling digital products and currently the MarketPress sending two notification emails
when a new order is made and when an order is shipped and both are identical.

  • Ivan

    Hi Stefan !

    First of all, they shouldn't be identical (of course, if you didn't set the same templates for them) I tested it on my test site and I received two emails Your Order Confirmation and Your Order Is Ready To Be Downloaded! with different email messages (I didn't change templates of notifications). Anyway if you just want to deactivate Digital Download Order email notification when Order Shipped you can create MU plugin (for example, {wordpress_folder}/wp-content/mu-plugins/wpmu_deactivate_shipped_notifications.php) via FTP with the following code

    <?php
    add_filter('mp_order/shipment_notification_subject', '__return_empty_string');
    add_filter('mp_order/shipment_notification', '__return_empty_string');

    Note: this code deactivates all Shipped Notification but if you use only digital products it will work fine for you.
    But if you want to deactivate only Shipped Notification for digital products you can use this code instead of previous one

    <?php
    function wpmu_deactivate_digital_shipped_notifications( $text, $obj ) {
    	$has_downloads = $has_physical = false;
    	$items = $obj->get_cart()->get_items_as_objects();
    	foreach ( $items as $product ) {
    		if( $product->is_download() ) {
    			$has_downloads = true;
    		} else {
    			$has_physical = true;
    		}
    	}
    	if ( $has_downloads && !$has_physical ) {
    		$text = '';
    	}
    
    	return $text;
    }
    add_filter('mp_order/shipment_notification_subject', 'wpmu_deactivate_digital_shipped_notifications', 10, 2 );
    add_filter('mp_order/shipment_notification', 'wpmu_deactivate_digital_shipped_notifications', 10, 2 );

    Best regards,
    Ivan.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.