Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Membership › Membership invoice for free plan?
- This topic has 10 replies, 2 voices, and was last updated 5 years, 2 months ago by WCFM Forum.
- AuthorPosts
- August 29, 2019 at 10:03 am #78915meParticipant
Hi,
If I enable invoices for membership subscriptions, then all free signups will get a $0 invoice, which is confusing and makes little sense. Is there a way to exclude the free plan from sending invoices?
Thanks.
- August 30, 2019 at 7:46 am #79179WCFM ForumMember
Hi,
Well, if it’s for Free plan or Free Trial Period subscription then it will generate $0 amount invoice.
But it will generate proper valued invoice when monthly subscription will be generate!
Thank You
- August 30, 2019 at 8:28 am #79200meParticipant
That’s not my issue.
I want to disable the $0 invoices, I don’t want any pdf attachments in the welcome email after free signups.
The “WooCommerce PDF Invoices & Packing Slips” plugin, which is required for vendor invoices, has a setting for this, “Disable for free products”. It says “Disable automatic creation/attachment when only free products are ordered” – This is exactly what I need, but the membership plugin ignores this setting, maybe it doesn’t even use the invoice plugin at all?I found a filter in the membership plugin code that might help but I can’t figure out how to use it for this purpose.
In core/class-wcfmvm.php, line 1048, there is the ‘wcfm_membership_subscription_attachment’ filter.
How do I use this filter to send NO attachment if the membership id matches that of my free plan?Also, where can I modify the template of the membershio invoice?
Thanks a lot
- September 2, 2019 at 5:14 am #79538WCFM ForumMember
Hi,
That’s possible.
DO you have set “Basic Membership” at WCFM Membership setting ? https://ibb.co/BnX3rqm
Thank You
- September 2, 2019 at 5:14 am #79539WCFM ForumMember
Hi,
That’s possible.
DO you have set “Basic Membership” at WCFM Membership setting ? https://ibb.co/BnX3rqm
Thank You
- September 2, 2019 at 8:14 am #79561
- September 4, 2019 at 6:43 am #79926WCFM ForumMember
Hi,
Please add this code to your site –
add_filter( 'wcfm_is_allow_membership_subscription_invoice', function( $is_allow, $membership_id, $member_id ) { if( function_exists('get_wcfm_basic_membership') ) { $basic_membership = get_wcfm_basic_membership(); if( $basic_membership && ( $basic_membership == $membership_id ) ) { $is_allow = false; } } return $is_allow; }, 50, 3 );
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/Thank You
- September 4, 2019 at 10:52 am #80002meParticipant
Thanks a lot!
The snippet didn’t actually work at first, but I managed to debug it.
First I got an ArgumentCountError, I fixed that but it was still sending invoices, so I decided to hardcode the membership_id into the function, and now it works fine:add_filter( 'wcfm_is_allow_membership_subscription_invoice', function( $is_allow ) { if( function_exists('wcfm_get_membership')) { $active_membership = wcfm_get_membership(); if ( $active_membership = '83254') { $is_allow = false; } } return $is_allow; }, 50, 3 );
Thanks a lot for your help, I’m happy that we could solve this.
- September 4, 2019 at 12:41 pm #80039WCFM ForumMember
Hi,
You were getting error because you not yet updated WCFM Ultimate to the latest version, 6.2.9
Your code is not right, don’t use this.
Thank You
- September 4, 2019 at 5:27 pm #80092WCFM ForumMember
But why? What’s wrong with my version?
– We have to check registered vendor’s membership. wcfm_get_membership() – this function does not return that.
If you enable “Registration Approval” option then will stop working.Thank You
- AuthorPosts
- You must be logged in to reply to this topic.