Hi Anthony,
Thank you for sharing the admin access.
I noticed that you're using this conditional code block in the archive for the product categories, which will only show "Products" post with post type "product".
This is why the condition to check product type is always true (as post type is never equal to "product_variation").
For such a condition, you'll first need to register a custom shortcode, that checks for the product's variations and then return the output accordingly, which can be used in the conditional code block.
( ref: https://toolset.com/documentation/adding-custom-code/how-to-create-a-custom-shortcode/ )
Example:
add_shortcode("check_product_variations", "check_product_variations_func");
function check_product_variations_func($atts) {
$a = shortcode_atts( array(
'id' => ''
), $atts );
if( (!empty($a['id'])) && (is_numeric($a['id'])) && (class_exists('WC_Product_Variable')) ) {
// get product's variations
$product = new WC_Product_Variable( $a['id'] );
$variations = $product->get_available_variations();
if(sizeof($variations) >= 1) {
// if product has a variation, return 1
return 1;
}
else
{
// else return 0
return 0;
}
}
// else return 0
return 0;
}
The above code can be included in the active theme's "functions.php" file and also add "check_product_variations" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.
This shortcode will accept an ID of the product and will return 0 if no variations exist and 1, if at least 1 variation exists.
Example:
[check_product_variations id="[wpv-post-id]"]
This is how it can then be used in the conditional code blocks:
( ref: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/ )
[wpv-conditional if="( '[check_product_variations id='[wpv-post-id]']' eq 1 )"]
This product has some variations
[/wpv-conditional]
[wpv-conditional if="( '[check_product_variations id='[wpv-post-id]']' eq 0 )"]
This product has no variation
[/wpv-conditional]
I hope this helps and for more personalized assistance around custom code, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
Important note: If you experience the error 500 issues after updating to the latest WPML version again, please report this at our WPML support forum ( https://wpml.org/forums ), for further investigation.
regards,
Waqar