Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #3139277
Suggestion for Improvement
Closed

Comments

  •  1
    Coleman M Geiger started the conversation

    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"


  •  767
    Janilyn replied

    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

  •  153
    Henry replied

    Hi,

    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.

  •  1
    Coleman M Geiger replied

    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

  •  153
    Henry replied

    Hi,

    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.

  •  1
    Coleman M Geiger replied

    This worked, thank you!!

  •  153
    Henry replied

    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.