Skip to content

Dokan Hooks Reference

Developer documentation for customizing BuddyX Pro’s Dokan integration.


Opens the container wrapper for store pages.

add_action( 'buddyx_store_container_open', 'my_store_container_open', 5 );
function my_store_container_open() {
echo '<div class="my-custom-wrapper">';
}

Default behavior: Outputs <div class="container">

Priority: 10


Closes the container wrapper for store pages.

add_action( 'buddyx_store_container_close', 'my_store_container_close', 15 );
function my_store_container_close() {
echo '</div><!-- .my-custom-wrapper -->';
}

Default behavior: Outputs </div>

Priority: 10


Dokan action hook - BuddyX Pro templates trigger this after the store header.

add_action( 'dokan_store_profile_frame_after', 'my_after_store_header', 10, 2 );
function my_after_store_header( $store_user_data, $store_info ) {
// Add content after store header
echo '<div class="store-announcement">';
echo 'Free shipping on orders over $50!';
echo '</div>';
}

Parameters:

  • $store_user_data (object) - Vendor user data
  • $store_info (array) - Store information array

Outputs the opening container div for store pages.

// Override in child theme
function buddyx_store_container_open() {
?>
<div class="container wide-container">
<?php
}

Usage: Called via action hook, typically in store templates.


Outputs the closing container div for store pages.

// Override in child theme
function buddyx_store_container_close() {
?>
</div><!-- .wide-container -->
<?php
}

Renders the store header in the “top” position.

// Check header position and render
$position = get_theme_mod( 'store_header_position', 'top' );
if ( 'top' === $position ) {
render_store_header_on_top();
}

Output:

<div class="dokan-single-store dokan-single-store-top">
<div class="store-page-wrap" role="main">
<!-- Store header template -->
</div>
</div>

// Store header position
$position = get_theme_mod( 'store_header_position', 'top' );
// Values: 'top' or 'inner'
// Store layout (sidebar position)
$layout = get_theme_mod( 'store_layout', 'left' );
// Values: 'left' or 'right'

Variable Type Description
$store_user object Dokan vendor object
$store_info array Store information
$map_location string Store location
$layout string Sidebar layout
$position string Header position
// Example: Access store user in template
$store_user = dokan()->vendor->get( get_query_var( 'author' ) );
$store_name = $store_user->get_shop_name();
$store_url = $store_user->get_shop_url();

Class Applied When
.layout-left Left sidebar layout
.layout-right Right sidebar layout
.dokan-single-store Main store container
.dokan-single-store-top Store header at top
Class Element
.container Main container wrapper
.dokan-store-wrap Store content wrapper
.store-page-wrap Store page inner wrapper

Override these templates in your child theme:

child-theme/dokan/
├── store.php # Main store page
├── store-sidebar.php # Store sidebar
├── store-toc.php # Table of contents
├── store-reviews.php # Store reviews
└── vendor-biography.php # Vendor biography

Child theme: dokan/store.php

<?php
/**
* Custom store template
*/
$store_user = dokan()->vendor->get( get_query_var( 'author' ) );
$store_info = $store_user->get_shop_info();
get_header( 'shop' );
// Your custom store layout here
get_footer( 'shop' );

// Remove theme container
remove_action( 'buddyx_store_container_open', 'buddyx_store_container_open' );
remove_action( 'buddyx_store_container_close', 'buddyx_store_container_close' );
// Add your own
add_action( 'buddyx_store_container_open', function() {
echo '<div class="my-container">';
});
add_action( 'buddyx_store_container_close', function() {
echo '</div>';
});

// By author query var (on store page)
$vendor = dokan()->vendor->get( get_query_var( 'author' ) );
// By user ID
$vendor = dokan()->vendor->get( $user_id );
$vendor->get_shop_name(); // Store name
$vendor->get_shop_url(); // Store URL
$vendor->get_shop_info(); // All store info array
$vendor->get_location(); // Store location
$vendor->get_banner(); // Banner URL
$vendor->get_gravatar(); // Avatar URL
$vendor->is_featured(); // Is featured vendor
$vendor->get_rating(); // Store rating

The store template uses these WooCommerce hooks:

// Before main content
do_action( 'woocommerce_before_main_content' );
// Product loop
woocommerce_product_loop_start();
wc_get_template_part( 'content', 'product' );
woocommerce_product_loop_end();
// After main content
do_action( 'woocommerce_after_main_content' );

The store template supports Yoast breadcrumbs:

if ( function_exists( 'yoast_breadcrumb' ) ) {
yoast_breadcrumb( '<p id="breadcrumbs">', '</p>' );
}