• Resolved Antreas Georgiou

    (@antrosgeor)


    add_filter( 'woocommerce_get_availability', 'filter_woocommerce_get_availability', 10, 2 );
    
    function filter_woocommerce_get_availability( $availability, $product ) {
    $specific_categories1 = array( 'available', 'Διαθ?σιμο', 'διαθ?σιμο');
    if ( $product->is_in_stock() && has_term( $specific_categories1, 'product_tag', $product->get_id() ) ) {
        $availability['availability'] = __('Διαθ?σιμοssTag', 'woocommerce' );
    }
    
    $specific_categories2 = array( 'Διαθ?σιμο απ? 1 ?ω? 3 ημ?ρε?');
    
    if ( $product->is_in_stock() && has_term( $specific_categories2, 'product_tag', $product->get_id() ) ) {
        $availability['availability'] = __('Διαθ?σιμο απ? 1 ?ω? 3 ημ?ρε?', 'woocommerce' );
        $availability['availability_newText'] = __('Διαθ?σιμο απ? 1 ?ω? 3 ημ?ρε?', 'woocommerce' );
    }
    $specific_categories3 = array( 'Διαθ?σιμο απ? 4 ?ω? 10 ημ?ρε?');
    
    if ( $product->is_in_stock() && has_term( $specific_categories3, 'product_tag', $product->get_id() ) ) {
        $availability['availability'] = __('Διαθ?σιμο απ? 4 ?ω? 10 ημ?ρε?', 'woocommerce' );
        $availability['availability_newText'] = __('Διαθ?σιμο απ? 4 ?ω? 10 ημ?ρε?', 'woocommerce' );
    }
    
    return $availability;
    }

    hey i use the above code on functios.php to change the text on the availability, but on my xml its shows me the old value .. how can I fix it ? can I use other variables to show the value?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    Thanks for reaching us,

    As you mentioned, you want to change the availability attribute value. To manipulate attribute value based on a condition, you can utilize a dynamic attribute. We recommend using a dynamic attribute to achieve this. Please have a look here.

    • This reply was modified 10 months, 1 week ago by Shahed.
    Thread Starter Antreas Georgiou

    (@antrosgeor)

    i would like to use code for this .. but I need to run the specific code only in one XML file .. for skrourz..

    Hello,

    Thanks for reaching us,

    You can try this filter woo_feed_get_skroutz_availability_attribute though we recommended using Dynamic Attribute.

    • This reply was modified 10 months, 1 week ago by Shahed.
    Thread Starter Antreas Georgiou

    (@antrosgeor)

    do you have any example with the woo_feed_get_skroutz_availability_attribute?

    Thread Starter Antreas Georgiou

    (@antrosgeor)

    for example somthing like this ?

     add_filter( 'woo_feed_get_skroutz_availability_attribute', 'woo_feed_get_skroutz_availability_attribute_value_modify', 9, 3 );
    
    if ( ! function_exists( 'woo_feed_get_skroutz_availability_attribute_value_modify' ) ) {
    function woo_feed_get_skroutz_availability_attribute_value_modify( $attribute_value, $product, $feed_config ) {
    $status = $product->get_stock_status();
       if ( 'in stock' === $attribute_value ) {
            $specific_categories2 = array( 'Διαθ?σιμο απ? 1 ?ω? 3 ημ?ρε?');
            $specific_categories3 = array( 'Διαθ?σιμο απ? 4 ?ω? 10 ημ?ρε?');
            if ( $product->is_in_stock() && has_term( $specific_categories2, 'product_tag', $product->get_id() ) ) {
                $in_stock_string = 'Διαθ?σιμο απ? 1 ?ω? 3 ημ?ρε?';
            }else if ( $product->is_in_stock() && has_term( $specific_categories3, 'product_tag', $product->get_id() ) ) {
                $in_stock_string = 'Διαθ?σιμο απ? 4 ?ω? 10 ημ?ρε?';
            }else {
                $in_stock_string =  'Διαθ?σιμο';
            }
    
        } else {
            $in_stock_string = $attribute_value;
        }
        return $in_stock_string;
    }
    }

    Hello,

    Thanks for reaching us,

    Sorry we don’t have any since it’s not available in free version. This filter ?woo_feed_get_skroutz_availability_attribute only help you to change the value.

    Thread Starter Antreas Georgiou

    (@antrosgeor)

    ok thanks.

    please where i can find the list with all filter like “woo_feed_get_skroutz_availability_attribute”?

    for example i will need to do the same for bestprice, google , ……..

    Plugin Support mansary

    (@mansary)

    Hi,

    We hope you’re having a great experience using CTX Feed. Since we haven’t received any further replies on this topic, we’ll be marking it as resolved for now.

    If you have any additional questions or need assistance, feel free to start a new conversation. We’re always here to help!

    Best regards,

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.