Skip to content

Common changes with a few lines of code (Recipes)

Reign Dokan Addon overviewPremiumGet Reign Dokan Addon →

Also called: code snippets, functions.php recipes, child theme examples, customise the marketplace with code, Dokan add-on hooks examples

Each recipe below makes one change that site owners often ask for. Copy the snippet, paste it into your child theme, and save. Every snippet was tested with Reign Dokan Addon 3.9.0, Dokan, Reign 8.1.0 and the official Reign child theme.

  • Install and activate the Reign child theme. Changes in the parent theme are lost when Reign updates.
  • Open the child theme’s functions.php. Paste each snippet at the very end of the file.
  • Edit files through your host’s file manager or SFTP. If a snippet has a typo, the site can show an error. You can then fix the file the same way.

Try each change on a staging copy first if your site is busy.

Each product page has a “Sold by” line with the shop name. The name links to the vendor’s store page. This snippet keeps the name and removes the link.

add_filter( 'reign_dokan_vendor_block_args', function ( $args ) {
$args['url'] = '';
return $args;
} );

The filter receives name (the shop name) and url (the store link). You can change the name too, for example to add a word after it.

You’ll know it worked when the product page reads “Sold by: Harbor & Pine” as plain text, with no link.

Members can save up to 200 products with the heart button. This snippet raises the limit to 500.

add_filter( 'reign_mv_favourites_cap', function () {
return 500;
} );

The Reign WC Vendors add-on reads the same filter. A value below 1 is treated as 1.

You’ll know it worked when this WP-CLI command prints 500: wp eval 'echo Reign_Dokan_Favourites::cap();'. Members can then keep saving past 200 products.

Vendor profiles get a Store tab on BuddyPress and BuddyBoss. This snippet makes it off by default, for example when you set up many sites from one child theme.

add_filter( 'reign_dokan_default_settings', function ( $defaults ) {
$defaults['store_tab'] = 0;
return $defaults;
} );

A value an owner saved on the settings screen still wins. On a site where someone already saved the settings, switch Store tab on vendor profiles off there instead.

You’ll know it worked when a vendor’s profile shows no Store tab.

Change one template: the “Sold by” words

Section titled “Change one template: the “Sold by” words”

This override changes “Sold by:” on product pages to “From the shop of”. Use the same steps for the other files in the add-on’s templates/ folder.

  1. Copy reign-dokan-addon/templates/sold-by.php.

  2. Paste it into your child theme at reign-child-theme/dokan/reign/sold-by.php. Create the dokan and reign folders if they are missing.

  3. In your copy, find this text.

    <?php esc_html_e( 'Sold by:', 'reign-dokan' ); ?>
  4. Replace it with this text.

    <?php esc_html_e( 'From the shop of', 'reign-child' ); ?>
  5. Save the file.

You’ll know it worked when product pages read “From the shop of Harbor & Pine”.

Keep the @version 1.0.1 line in your copy. After an add-on update, an admin notice lists your copy if the original changed. Then compare your copy with the new file. See Filters and templates.

Open functions.php again through your host’s file manager or SFTP. Remove the snippet you just added and save. The site comes back straight away.

Yes. The PHP snippets work the same in a snippets plugin. The template recipe needs the child theme, because it is a file.

Every hook the add-on offers is in Filters and templates.