This Pro tutorial provides the steps for setting up a dynamic data condition on any element in Bricks so it can be output only if the logged-in user has purchased any of the WooCommerce products specified by their ID(s).
After adding the code for a custom function named bl_has_user_purchased_any_of_these_products
, you will be able to add a condition like this:
{echo:bl_has_user_purchased_any_of_these_products(2076, 2164)}
This Section will then be rendered only if the currently logged-in user bought at least one of the two specified products (having the ID of 2076 or 2164). For everyone else incl. the guest visitors, the Section will not be output.
To conditionally check and output if the user has purchased a single product with the ID of 2076:
{echo:bl_has_user_purchased_any_of_these_products(2076)}
Step 1
Add the following in child theme's functions.php
(w/o the opening PHP tag) or a code snippets plugin:
This is a BricksLabs Pro tutorial.
For full access login below or create your BricksLabs Pro account