How to create a Patreon-only section of my Woocommerce site?


#1

Hi, I’m trying to create a section of my Woocommerce site that is only accessible to my Patreon backers. Any suggestions on how to do that?

I tried using the plugin, but that seems primarily focused on locking posts. I tried creating an item in my shop that could only be purchased by Patreon supporters, but the only thing the plugin hid was the product description (image here). Anyone could see the thumbnail (which should have been locked) and order the yo-yo without signing in to Patreon.

Ideally, I’d have a section of my ecommerce shop that only Patreon supporters could see and order from.


#2

That’s a bit advanced usage, indeed.

And yes, with the current setup, the plugin would only hide product description - since it treats it as a post.

To prevent viewing and ordering of patron-only products, it would be necessary to hook into woocommerce ordering process and do a check for pledge level of the user.

Patreon_Wordpress::getUserPatronage();

…would give you the pledge level of the user. Checking if that meets the minimum amount you may set for this, (ie, 5, etc) then you can prevent or allow checkout after that.

woocommerce_check_cart_items action hook may be useful.

There is an implementation for preventing checkout if cart contains certain products:

You can duplicate this function, insert the pledge check somewhere, and hijack the category-checking code of the function and instead do pledge checking.

Also, the visual hooks for checkout page template are below - these can help you to display messages to users if they are not patrons:


#3

That’s a great set of suggestions, thanks!

But my main hope is to block that category of my shop from even being visible to non-backers. I’m worried that if non-patrons can see items (and place them in their cart along with items from the rest of my shop), they may just rage quit and abandon their cart.

I also like that hiding the items adds a little mystery.


#4

That also could be done by the same method:

In the category listing page (or any search pages), just check for pledge level of the user with earlier mentioned function. If its lower than what you would desire, then just abort the page with a message or any other way. Best would be to just avoid printing any result but render the page.

Note that you will still need to implement the earlier suggestion too, because even if the user may not see the product from category page, s/he may find it through other means (google etc) and just check out.