In this guide, you’ll learn how to setup Easy Digital Downloads (EDD) and Conditional Blocks within WordPress to detect which products are in the customers cart. You’ll then be able to create dynamic content by controlling the visibility of specific WordPress blocks based on the specific products in the cart.
Whether you want to offer special content, promotions, or additional product recommendations, this condition can help you tailor your content to the shopping behavior of your customers.
What can you create by detecting product?
- Personalized Recommendations: Show related product suggestions based on what the customer already has in their cart.
- Promotional Content: Display special offer blocks for customers who have certain products that qualify for a promotion.
- Upselling Opportunities: Highlight premium versions or add-ons of the products in the cart to encourage an upgrade.
Requirements
These are the minimum requirements you need to meet on your WordPress site in order to setup the Cart Products visibility Condition.
- Easy Digital Downloads plugin installed and activated.
- Conditional Blocks Pro plugin installed and activated.
- The WordPress Block Editor enabled (aka Gutenberg).
- At least one product (e.g., an e-book) added to your Easy Digital Downloads store.
Setting up the Cart Products Condition
Select the Block You Want to Conditionally Display: Choose or create the block that will hold your promotional content or special offer. You can be creative with content you create..
Access Visibility Settings: Click any block and navigate to the Conditional Blocks visibility settings in the block settings sidebar.
Configure the Condition: In the visibility settings, select the “Cart Products” condition. Choose the specific product (in our case, the e-book) that will trigger the visibility of the block. You can also set additional parameters such as the minimum quantity required in the cart.
Combine Conditions (Optional): Utilize “AND/OR” logic to combine multiple conditions (such as the EDD Cart Value) for more complex visibility rules.
Preview and Publish: Preview your page to ensure the block appears correctly when the conditions are met. Once you’re satisfied, publish or update your page.
Well done, you’ve successfully changed the block content if the customer has the “ebook” in the cart or not. There’s many use-cases we haven’t covered in this guide, anything is possible – it’s all about being creative with Conditional Blocks.