• Hello,

    I found this code while searching online

    add_filter( 'wcfm_product_custom_attributes', function( $taxonomy_fields, $att_taxonomy ) {
    if( isset( $taxonomy_fields[$att_taxonomy] ) && isset( $taxonomy_fields[$att_taxonomy]['options'] ) ) {
    if( isset( $taxonomy_fields[$att_taxonomy]['options']['is_active'] ) ) {
    $taxonomy_fields[$att_taxonomy]['options']['is_active']['custom_attributes'] = array( 'required' => 1, 'required_message' => 'Attributes are required' );
    }
    if( isset( $taxonomy_fields[$att_taxonomy]['options']['value'] ) ) {
    $taxonomy_fields[$att_taxonomy]['options']['value']['custom_attributes'] = array( 'required' => 1, 'required_message' => 'Attributes are required' );
    }
    }
    return $taxonomy_fields;
    }, 50, 2);

    Apparently it helps you to make certain attributes required when a vendor is uploading a product.
    I have the following attributes which should be mandatory:
    – color
    – size
    – weight
    I’ve tried replacing in the code but with no luck. Could somebody please tell me how to do it correctly? I just need help with that, please!

    Thank you

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

  • The topic ‘Mandatory attributes’ is closed to new replies.