Support » Plugin: Dokan - Best WooCommerce Multivendor Marketplace Solution - Build Your Own Amazon, eBay, Etsy » New mandatory dropdown field on Product add/edit pages in Dokan

  • Resolved teamf

    (@teamf)


    Hi,

    I have just started using Dokan (free) for my website and am loving it so far. I want to add one new field to the Vendor and Admin product Add/Edit pages and have searched the forums but nothing that has worked so far. Any help is much appreciated. Requirements are:

    – Add new dropdown field on the vendors front end Product Add & edit pages
    – Add new dropdown field on the WP Admin back end Product Add & edit pages
    – This new field should be Mandatory for ALL products

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Mushrit Shabnam

    (@611shabnam)

    Hello @teamf,

    We can help you with the file location, so that you can override the template folder and add proper custom code as required within the child theme. If you modify directly within the files of Dokan, it will be removed over plugin update, which is discouraged.

    Add new dropdown field on the vendors front end Product Add & edit pages: You have to navigate through wp-content/plugins/dokan-lite/templates/products/new-product-single.php and wp-content/plugins/dokan-lite/templates/products/tmpl-add-product-popup.php.

    Since the above files are within the template folder, you have to override the template folder and add proper custom code using the child theme.

    For backend product add and edit dropdown, you have to add proper custom code in WooCommerce.

    Thank you!

    Thanks for you help. I have added the dropdown now to the front-end pages by overriding the template files in my Theme. I assume when I upgrade to Pro, these files names/paths dont change?

    One issue I am having is that the new field that I have added to the front-end does not save, although it does save from the back-end.

    The code I have on the Frontend is
    <div class=”dokan-form-group”>
    <div class=”dokan-input-group”>
    <span class=”dokan-input-group-addon”>Organization: <?php echo get_post_meta( $post->ID, “_org”, true ); ?></span>
    <div class=”dokan-form-control”>
    <select class=”dokan-form-control ” name=”_org” wccaf-type=”select” wccaf-pattern=”mandatory” wccaf-mandatory=”yes”>
    <option value=””>Select Org :</option>
    <?php organization_dropdown_list();?>
    </select>
    </div>
    </div>
    </div>

    And the code in the Functions.php is

    // Save Fields
    add_action( ‘woocommerce_process_product_meta’, ‘x_add_fields_save’ );
    add_action( ‘dokan_process_product_meta’, ‘x_add_fields_save’ );
    add_action( ‘dokan_new_product_added’, ‘x_add_fields_save’ );

    function x_add_fields_save( $post_id ){

    // Number Field
    $woocommerce_new_field = $_POST[‘_org’];
    if( !empty( $woocommerce_new_field) )
    update_post_meta( $post_id, ‘_org’, esc_attr( $woocommerce_new_field ) );

    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘New mandatory dropdown field on Product add/edit pages in Dokan’ is closed to new replies.