Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/dplugins-code/htdocs/code.dplugins.com/wp-includes/functions.php on line 6131

Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/dplugins-code/htdocs/code.dplugins.com/wp-includes/functions.php on line 6131
Show/hide section based on Number of WooCommerce Upsells in Oxygen on single product – Code DPlugins

Show/hide section based on Number of WooCommerce Upsells in Oxygen on single product

1st Step

Install and activate Code Snippets plugin.

Add below code in code snippets:

function wpl_check_upsell_product(){
   $upsell_product = wc_get_product( get_the_ID() );
   $count = count( $upsell_product->get_upsell_ids() );
   return $count;
}	

2nd Step

Edit the Oxygen Template that applies to woo single products.

For the element you want to apply the “minimum 1 upsell” condition, click on Conditions icon then Set Conditions.

Click “Add Condition” icon.

Choose Dynamic Data condition.

Under Advanced click PHP Function Return value.

Function Name: wpl_check_upsell_product

Set the operator, >=

Set the value 1.

Click to Copy