Comments 1Coleman M Geiger started the conversationOctober 5, 2022 at 2:56pmIf a product is out of stock I'd love for it to show the product with a lower opacity so the customer can see it's out of stock before clicking it. Add a ".outofstock" class to the same div class as "wpclv-term" 767Janilyn repliedOctober 6, 2022 at 9:28amHi Coleman, Thank you for contacting WPClever Support Forum. We’ve received your ticket and assigned one of our developers to consider that. He’ll be looking into your request and responding as soon as possible. Please stay patient as we're having very heavy workloads, it might take some time for our developers to reach back. Best regards. Janilyn T. - WPClever Support Agent 153Henry repliedOctober 7, 2022 at 7:52amHi,Please add the below custom code (How to add custom code?) // Wpclever team support ticket-3139277 add_filter( 'wpclv_term_swatches', 'wpclv_term_custom_html', 99, 3 ); add_filter( 'wpclv_term_image', 'wpclv_term_custom_html', 99, 3 ); add_filter( 'wpclv_term_button', 'wpclv_term_custom_html', 99, 3 ); function wpclv_term_custom_html($html, $term, $product_id){ if( intval($product_id) > 0 && $product = wc_get_product($product_id) ){ $html = str_replace('class="wpclv-term', 'class="wpclv-term ' . $product->get_availability_class() . ' ', $html); } return $html; }Best regards,Henry N. 1Coleman M Geiger repliedOctober 12, 2022 at 2:24pmI get several errors when adding this code: Uncaught Error: Call to protected method WC_Product::get_availability_class() from context /public/wp-includes/class-wp-hook.php(307): wpclv_term_custom_html('<div class="wpc...', Object(WP_Term), 2927) #1/public/wp-includes/plugin.php(191): WP_Hook->apply_filters('<div class="wpc...', Array) #2/public/wp-content/plugins/wpc-linked-variation/wpc-linked-variation.php(932): apply_filters('wpclv_term_imag...', '<div class="wpc...', Object(WP_Term), 2927) #3/plugins/wpc-linked-variation/wpc-linked-variation.php(1096): WPCleverWpclv::term('image', Object(stdClass), Object(WP_Term), true, 2927) #4/public/wp-includes/class-wp-hook.php(307): WPCleverWpclv::render(2927) #5 153Henry repliedOctober 13, 2022 at 1:02amHi,Please add the below custom code (How to add custom code?) // Wpclever team support ticket-3139277 add_filter( 'wpclv_term_swatches', 'wpclv_term_custom_html', 99, 3 ); add_filter( 'wpclv_term_image', 'wpclv_term_custom_html', 99, 3 ); add_filter( 'wpclv_term_button', 'wpclv_term_custom_html', 99, 3 ); function wpclv_term_custom_html($html, $term, $product_id){ $product = wc_get_product($product_id); if( intval($product_id) > 0 && $product ){ $html = str_replace('class="wpclv-term', 'class="wpclv-term ' . $product->get_availability()['class'] . ' ', $html); } return $html; }Best regards,Henry N. 1Coleman M Geiger repliedOctober 13, 2022 at 1:09amThis worked, thank you!!1 Like 153Henry repliedOctober 13, 2022 at 2:19amIf you need help from us at any time, feel free to reach out to us. We are always ready to help.Best regards,Henry N. Sign in to reply ...
If a product is out of stock I'd love for it to show the product with a lower opacity so the customer can see it's out of stock before clicking it. Add a ".outofstock" class to the same div class as "wpclv-term"
Hi Coleman,
Thank you for contacting WPClever Support Forum.
We’ve received your ticket and assigned one of our developers to consider that. He’ll be looking into your request and responding as soon as possible.
Please stay patient as we're having very heavy workloads, it might take some time for our developers to reach back.
Best regards.
Janilyn T. - WPClever Support Agent
Hi,
Please add the below custom code (How to add custom code?)
Best regards,
Henry N.
I get several errors when adding this code
: Uncaught Error: Call to protected method WC_Product::get_availability_class() from context
/public/wp-includes/class-wp-hook.php(307): wpclv_term_custom_html('<div class="wpc...', Object(WP_Term), 2927) #1
/public/wp-includes/plugin.php(191): WP_Hook->apply_filters('<div class="wpc...', Array) #2
/public/wp-content/plugins/wpc-linked-variation/wpc-linked-variation.php(932): apply_filters('wpclv_term_imag...', '<div class="wpc...', Object(WP_Term), 2927) #3
/plugins/wpc-linked-variation/wpc-linked-variation.php(1096): WPCleverWpclv::term('image', Object(stdClass), Object(WP_Term), true, 2927) #4
/public/wp-includes/class-wp-hook.php(307): WPCleverWpclv::render(2927) #5
Hi,
Please add the below custom code (How to add custom code?)
Best regards,
Henry N.
This worked, thank you!!
If you need help from us at any time, feel free to reach out to us. We are always ready to help.
Best regards,
Henry N.