I had to edit the code of someone else, it's a plugin in Wordpress but i'm kinda stuck here.
<?php
woocommerce_wp_checkbox(
array(
'id' => 'per3',
'label' => __('Per 3', 'woocommerce' ),
'description' => __( 'ja', 'woocommerce' ),
'value' => $variation_data['per3'][0]
)
);
?>
This is the array part , and at Per 3 it's supposed to be checked and stay checked however,
function variable_fields_process( $post_id ) {
if (isset( $_POST['variable_sku'] ) ) {
$variable_sku = $_POST['variable_sku'];
$variable_post_id = $_POST['variable_post_id'];
$variable_custom_field = $_POST['per3'];
for ( $i = 0; $i < sizeof( $variable_sku ); $i++ ) {
$variation_id = (int) $variable_post_id[$i];
if ( isset( $variable_custom_field[$i] ) ) {
update_post_meta( $variation_id, 'per3', stripslashes( $variable_custom_field[$i] ) );
}else{
delete_post_meta( $variation_id, 'per3', stripslashes( $variable_custom_field[$i] ) );
}
}
}
This is the process part, and i'm not a advanced coder at all, so this doesn't tell me a whole lot other than that there's no way in it to save , i've tried different stuff like checking the box, but to no avail.
Aucun commentaire:
Enregistrer un commentaire