As of WP Job Manager Packages release 1.4.0, there is a lot of new handling and features around the “give” functionality. If you’re unfamiliar with the “give” functionality, this is a feature in the plugin that allows you to give a Job/Resume Visibility Package or Subscription when a user purchased another WooCommerce product (any kind of product). Most commonly this is used in conjunction with the WooCommerce Paid Listings addon, to give users a Job/Resume Visibility package when they purchase a package to submit a job or resume.
Previous version of WP Job Manager Packages had this feature available in it, but nowhere near the extend of the functionality introduced and added in 1.4.0. Prior to version 1.4.0, if the product purchased that would “give” the free visibility package was a subscription or single product, it made no difference, and there was no synchronization between the purchased product.
As of version 1.4.0, this has all changed, there is now full synchronization between the visibility packages if the purchased product is a subscription. Below I will go over the details of this, what has changed, and give a few examples of how you can set this up to make your site that much more awesome!
One thing to note, this new functionality is only around the PURCHASED product being some kind of subscription. A single product purchase will still work as it did prior to the 1.4.0 update. You will only see the new settings listed below if you’re also using the WooCommerce Subscriptions addon (sold separately).
New Settings
The 1.4.0 release adds two new settings available when setting up a product (see below for examples):
- Give on Sub Renew
When enabled (default is enabled), if the purchased product is a subscription, when that associated subscription is renewed, the “given” visibility product will also be renewed (if subscription) or given again (if standard visibility product).Example: A Job Submission Subscription is purchased that gives a free Resume Visibility Subscription. When the Job Subscription is renewed, the Resume Subscription will be automatically renewed (at no cost). - Match Sub Status
When enabled (default is disabled), any given package (subscription or standard) will have its status matched against the purchased subscription product.Example: A Job Submission Subscription is purchased that gives a free Resume Visibility package. The Job Subscription expires, or is cancelled (not renewed). All associated “given” Resume Visibility products will be set to this same status.
Handling Specifics
Given Product is Subscription
In the situation where the given product is a free subscription, when the “purchased” product that gives this subscription for free is made, the WP Job Manager Packages plugin automatically creates a $0 order in WooCommerce for the given subscription (to not mess with reporting). This is regardless of the price set on the given product, that value is however carried over to the subscription (just not the order).
The status of this order is set to completed, and the Subscriptions addon handles all processing like normal (as if the user had actually purchased the subscription). Notes are added on both the subscription and the order, with details of what product/subscription was purchased to give the visibility subscription for free.
- If rollover is enabled, this will be applied on renewal
Emails
By default, all normal subscription and order emails will still be sent like normal. The order emails will all show the $0 cost to the user, and gives them a good understanding of the benefit of what they are getting for their purchase.
If for some reason you want to prevent some of these emails from sending, you can do so using a filter to prevent them from sending. Just add the code snippets below (for emails you want to prevent from sending) to your child theme’s functions.php file (omit the <?php, there only needs to be one at the top of the functions.php file), or using the Code Snippets plugin.
Prevent Give New Subscription “Completed” Order Email
This filter applies to the order email for both give on product purchase and give on user registration. If you use this filter to disable order emails but want email enabled for user registration, use the filter listed below “Enable Give New Subscription Order (On Registration) Email”
Developers: to see all available parameters, check the file located at /wp-content/plugins/wp-job-manager-packages/includes/give.php in the give_user_subscription method.
<?php add_filter( 'job_manager_packages_give_user_subscription_prevent_completed_order_email', 'jmp_give_prevent_completed_new_sub_order_email' ); function jmp_give_prevent_completed_new_sub_order_email( $send ){ return true; }
Enable Give New Subscription (on Registration) “Completed” Order Email
This is only needed if you’re using the filter above to disable new order emails for give on product purchase, and want to keep emails for on registration.
Developers: to see all available parameters, check the file located at /wp-content/plugins/wp-job-manager-packages/includes/give.php in the give_register_package method.
<?php add_filter( 'job_manager_packages_give_reg_user_subscription_enable_order_email', 'jmp_give_enable_reg_new_sub_order_email' ); function jmp_give_enable_reg_new_sub_order_email( $send ){ return true; }
Prevent Give Subscription Renewal “Completed” Order Email
Developers: to see all available parameters, check the file located at /wp-content/plugins/wp-job-manager-packages/includes/give/wc.php in the check_give_related_sub_renewal method.
<?php add_filter( 'job_manager_pacakges_give_renew_user_subscription_prevent_completed_order_email', 'jmp_give_prevent_completed_renew_sub_order_email' ); function jmp_give_prevent_completed_renew_sub_order_email( $send ){ return true; }