Enable custom frontend posting for Dokan

As you know, Dokan plugin uses own frontend submit system. Problem is that you can’t customize it. Sometimes, you want to change some fields, add own fields and even want to use own frontend submit plugin. Here simple code which can allow to redirect “add product” button to your custom page instead of default.

So, first of all, create page with submit form which you will use, then, go to Dokan – Settings – Selling Options and disable there Product Popup

Then, add in theme option – general – js code in footer next script

<script>
jQuery(document).ready(function($) {
var mynewsubmitlink = 'http://localhost/wordpress/add-post/';
$(document).on('click', '.dokan-add-product-link a', function(e){
    e.preventDefault();
    window.location.href= mynewsubmitlink;
});
});
</script>

Instead of http://localhost/wordpress/add-post/ add you link on page with submit form

Maybe, you will need also to change all Edit links. Now, you must create Page with Edit form shortcode. It must be separate page with own link. Now, full code with add and edit modified links.

<script>
function getParameterByName(name, url) {
 if (!url) url = window.location.href;
 name = name.replace(/[\[\]]/g, "\\$&");
 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
 results = regex.exec(url);
 if (!results) return null;
 if (!results[2]) return '';
 return decodeURIComponent(results[2].replace(/\+/g, " "));
}
jQuery(document).ready(function($) {
var mynewsubmitlink = 'http://localhost/wordpress/add-post/';
var myneweditlink = 'http://localhost/wordpress/edit-page';
$(document).on('click', '.dokan-add-product-link a', function(e){
 e.preventDefault();
 window.location.href= mynewsubmitlink;
});
$(document).on('click', '.dashboard-widget .widget-title a', function(e){
 e.preventDefault();
 window.location.href= myneweditlink;
});
$('.product-listing-table .row-actions').each(function(e){
var link = $(this).find('.delete a').attr('href');
var linkid = getParameterByName('product_id', link);
$(this).find('.edit a').attr('href', myneweditlink +'?wpfepp_action=edit&wpfepp_post='+linkid);
});
});
</script>

Instead of http://localhost/wordpress/aedit-page/ add you link on page with edit form

This code is for RH frontend PRO plugin. If you have another plugin, you need to check link structure of edit page and place it instead of

$(this).find('.edit a').attr('href', mynewsubmitlink +'?wpfepp_action=edit&wpfepp_post='+linkid);

 

for example, it can be

var producteditlink = $(this).find('.edit a').attr('href');
var neweditlink = producteditlink.replace('edit', '?puff=edit&puff_post='+linkid);