Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter grigoriadis24

    (@grigoriadis24)

    Thank you for your time, I could find a solution with variations of my products. I let you know if need anything else.. thanks again!

    Thread Starter grigoriadis24

    (@grigoriadis24)

    Hello there and thank you for your respond.. No, I am not using an entire plugin for that.. I have just added a custom function in function.php file, thus I have the custom field inside variables.. But, I can not select this custom field in your filters and rules dropdown list you have in your plugin. If it helps, I use this code:

    // Display custom field to variation
    add_action( ‘woocommerce_variation_options_pricing’, ‘show_custom_field_in_variations’, 10, 3 );
    function show_custom_field_in_variations( $loop, $variation_data, $variation ) {
    woocommerce_wp_text_input( array(
    ‘id’ => ‘exclude_variation_skroutz_’ . $variation->ID,
    ‘label’ => __( ‘Exclude Variations from Skroutz’, ‘woocommerce’ ),
    ‘desc_tip’ => ‘true’,
    ‘description’ => __( ‘Enter 1 to exclude, otherwise 0’, ‘woocommerce’ ),
    ‘value’ => get_post_meta( $variation->ID, ‘_exclude_variation_skroutz’, true )
    ) );
    }

    // save custom field to DB
    add_action( ‘woocommerce_save_product_variation’, ‘save_custom_field_variations’, 10, 2 );
    function save_custom_field_variations( $variation_id, $i ) {
    $custom_field = $_POST[‘exclude_variation_skroutz_’ . $variation_id];
    if ( isset( $custom_field ) ) {
    update_post_meta( $variation_id, ‘_exclude_variation_skroutz’, esc_attr( $custom_field ) );
    }
    }

    Thus, I have a field with a value of 1 or 0.. If the value is 1 I want to exclude this variation from the XML I generate.. What should I do to find this custom field in your plugin? I also have this code:

    add_filter(‘wf_feed_product_custom_fields’, ‘add_custom_fields_to_feed’, 10, 1);
    function add_custom_fields_to_feed($custom_fields) {
    $custom_fields[] = ‘exclude_variation_skroutz’;
    return $custom_fields;
    }

    but did not work! thank you for your time, please advice me!

    Thread Starter grigoriadis24

    (@grigoriadis24)

    Got it, sorry for any inconvenience

Viewing 3 replies - 1 through 3 (of 3 total)