PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Variation custom field

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi,

I have created a custom selectable field for variations, but WOOBE could not find it. Then I added it to WOOBE manually using the custom key"cf_pv_file_format". Now I can see the content of the customer field in WOOBE as a text string.

The issue is that it is not editable in WOOBE. Can you please advise how to fix it?

Thank you.

 

By the way, I have created a custom selectable field for variations using the following snippet:

add_action( 'woocommerce_product_after_variable_attributes','variation_settings_fields', 10, 3 );
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 );
function variation_settings_fields( $loop, $variation_data, $variation ) {
woocommerce_wp_select(
array(
'id' => 'cf_pv_file_format[' . $variation->ID . ']',
'label' => __( 'File Format', 'woocommerce' ),
//'description' => __( 'Choose a value.', 'woocommerce' ),
'value' => get_post_meta( $variation->ID, 'cf_pv_file_format', true ),
'options' => array(
'' => __( 'Select...', 'woocommerce' ),
'pdf' => __( 'Full-text PDF', 'woocommerce' ),
'raster_pdf' => __( 'Raster PDF', 'woocommerce' )
)
)
);
}
function save_variation_settings_fields( $post_id ) {
$select = $_POST['cf_pv_file_format'][ $post_id ];
if( ! empty( $select ) ) {
update_post_meta( $post_id, 'cf_pv_file_format', esc_attr( $select ) );
}
}

 

Hi again,

 

I noticed that WOOBE can edit the field but the edited value, I found this in the product edit page.

However, the edited value can not be displayed in the front end.

I use the following snippet for displaying the field on the front-end:

// Frontend: Display File Format on product variations
add_filter( 'woocommerce_available_variation', 'vp_variation_display_file_format', 10, 3 );
function vp_variation_display_file_format( $data, $product, $variation ) {
if( $value = $variation->get_meta( 'cf_pv_file_format' ) ) {
$data['price_html'] .= '<p class="vp-ccode"><small><strong>' . __("File Format","woocommerce") .
': </strong>'. strtoupper(str_replace("_","",$value)) .'</small></p>';
}
return $data;
}

 

Any help would be appreciated.

Regards

Hello
Unfortunately, the fact that you cannot display the meta field is not dependent on my plugin.
Try to use - get_post_meta()

Hello,

Thank you for the reply.

WOOBE provide editing the field as a text string, can you help so that it can identify the input as selectable options (as I have defined when creating the field through the first-mentioned snippet)?

 

Hello

Unfortunately this does not depend on my polagin, it depends on the current template

All I can advise is to use this function - get_post_meta()

Hello,

Can you please advise where shall I use the function - get_post_meta() ?

Please let me repeat my issue:

As you see in the code above, I have set two selectable options for the variation custom field: pdf and raste_pdf. But BEAR shows the contents of this field in the backend as a simple editable text string, not selectable options! I need BEAR to let me select an available option.

Any help would be appreciated.

Hello

Can you please advise where shall I use the function - get_post_meta() ? - You better hire a developer to set up your front-end. Unfortunately, third-party code customization is not included in our support.

I need BEAR to let me select an available option. - Meta fields are only editable as text or number. Please  watch  this  video - https://bulk-editor.com/video#video_1290