• Hello, is it please possible to somehow get to product feed, custom meta field on product variations level?

    We added meta field to our products but when I want to add it as custom field to feed, Im unable to find it between available values.

    Thank you very much for any help.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi,

    Thanks for using our plugin and reaching out to us.

    I am not entirely sure I understand your question but your created some custom fields (using the Advanced Custom Field plugin?), filled some of those fields on your product edit page but those custom fields are not showing up in the drop-downs on the field mapping page. Am I understanding correctly?

    Thread Starter silvo37

    (@silvo37)

    Hello, thanks for quick reply.
    It’s not ACF. It is basically post meta key and value.

    Thanks for your reply.

    Can you send us some screenshots of what you did so we can try to replicate it?

    I have the same problem. I think the question is that how could we get variation meta data field into the feed. Like if you add some custom field to variation like some label and you want to call it into field, then plugin does not give you this option to choose custom field from variable products. Available fields are only from regular.

    When you choose the value, the values of variable products like custom meta data are not available here. https://ctrlv.cz/Kyq4

    Can you send us some screenshots of what you did so we can try to replicate it?

    I have created custom fields for prices in product variations. We are building custom multicurrency over here. See the fields here like normálna cena and cena po zlave for each currency (regular and sale price fields) https://ctrlv.cz/7Q89

    Id like to be able to add these fields to product feed. As I mentioned here https://ctrlv.cz/Kyq4 . But theese fields for variations are not displayed there. Product feed offers only values from simple products. As I can see my custom fields for multicurrency which are for simple products. The same I add with the hook for variable ones, in the feed are not displayed. So I can not get or use filter to get the prices to the right place in the XML feed. Any solution for this please?

    You may use this code to reproduce custom field into variable product. Then go to the xml feed and try to get the value from variation_meta_price_kc or variation_meta_price_kc_sale. It will not be listed there. Could we use some snippet to get it there? Did not find any documentation with snippets for the plugin. Thank you!

    By the way: This input may be also for some label only, does not have to be for price so if you have some variable you could use variable meta for any purpose, but into the feed you can not get it. I think this is the same problem as @silvo37 has and the reason why he statred this topic here.

    add_action( 'woocommerce_variation_options_pricing', 'bbloomer_add_custom_field_to_variations', 10, 3 ); 
    function bbloomer_add_custom_field_to_variations( $loop, $variation_data, $variation ) {
       woocommerce_wp_text_input( array(
    'id' => 'variation_meta_price_kc[' . $loop . ']',
    'class' => 'short wc_input_price',
    'label' => __( 'Regular price (K?)', 'woocommerce' ),
    'value' => get_post_meta( $variation->ID, 'variation_meta_price_kc', true )
       ) );
       
          woocommerce_wp_text_input( array(
    'id' => 'variation_meta_price_kc_sale[' . $loop . ']',
    'class' => 'short wc_input_price',
    'label' => __( 'Sale price (K?)', 'woocommerce' ),
    'value' => get_post_meta( $variation->ID, 'variation_meta_price_kc_sale', true )
       ) );
       
    }
    
    add_action( 'woocommerce_save_product_variation', 'bbloomer_save_custom_field_variations', 10, 2 );
    function bbloomer_save_custom_field_variations( $variation_id, $i ) {
       $custom_fieldkc = $_POST['variation_meta_price_kc'][$i];
       $custom_fieldkcs = $_POST['variation_meta_price_kc_sale'][$i];
       if ( isset( $custom_fieldkc ) ) update_post_meta( $variation_id, 'variation_meta_price_kc', esc_attr( $custom_fieldkc ) );
       if ( isset( $custom_fieldkcs ) ) update_post_meta( $variation_id, 'variation_meta_price_kc_sale', esc_attr( $custom_fieldkcs ) );
    }
    • This reply was modified 2 years, 3 months ago by mikel555.

    Hi,

    For product variations those values are being saved in product array’s. The free version of our plugin is not capable of picking those up unfortunately.

    Paid version has this feature included?

    Unfortunately, per the WordPress forum guidelines, we’re not allowed to discuss our paid Elite plugin here so for any questions about our paid plugins, please contact our support team directly.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Meta field on product variations level’ is closed to new replies.