Checking for the Number of WooCommerce Upsells in Oxygen

One of the fantastic features of Oxygen is Conditions and the most powerful and versatile of them is the Dynamic Data condition.

This members-only tutorial shows how we can create a custom function that returns a count of the number of linked upsell products for a WooCommerce product and use this via the Dynamic Data condition to have an element be output only if there is at least 1 upsell (or conversely if there is no upsells if that is what you want) on single product pages.

Note: This is where/how we can specify upsells for products:

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [WooCommerce] Get the number of upsells

Code:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.


Posted

in

, ,

by

Comments

2 responses to “Checking for the Number of WooCommerce Upsells in Oxygen”

  1. yasien Avatar
    yasien

    Do you have a tutorial for setting up Related Products that will pull in only products within the same Category?

Leave a Reply

Your email address will not be published. Required fields are marked *