Use Product Attribute in conditional tag

You should be able to wrap the “return with price” section if the $term variable matches a certain value. I’m unsure what $term actually contains, but this should work. If not, you can modify the values in the if statements. //Add prices to variations add_filter( ‘woocommerce_variation_option_name’, ‘display_price_in_variation_option_name’ ); function display_price_in_variation_option_name( $term ) { global $wpdb, … Read more

Add custom ID attribute to all woocommerce products on archive pages

Copy /woocommerce/templates/content-product.php to /yourtheme/woocommerce/content-product.php and modify it as needed. In this case, we can change the opening <li> tag from this: <li <?php post_class(); ?>> to this: <li <?php post_class(); ?> id=”<?php echo esc_attr( ‘post-‘ . get_the_ID() ); ?>”> The updated content-product.php file will look like this: <?php /** * The template for displaying product … Read more