12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Oct 18, 2020

Checking for the Number of WooCommerce Upsells in Oxygen

Sridhar Katakam

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.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right