Dokan Hooks Reference
Developer documentation for customizing BuddyX Pro’s Dokan integration.
Action Hooks
buddyxstorecontainer_open
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 Priority: 10 Closes the container wrapper for store pages. Default behavior: Outputs
buddyxstorecontainer_close
add_action( 'buddyx_store_container_close', 'my_store_container_close', 15 );
function my_store_container_close() {
echo '</div><!-- .my-custom-wrapper -->';
}
Priority: 10
dokanstoreprofileframeafter
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:
$storeuserdata(object) – Vendor user data$store_info(array) – Store information array
Theme Functions
buddyxstorecontainer_open()
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.
buddyxstorecontainer_close()
Outputs the closing container div for store pages.
// Override in child theme
function buddyx_store_container_close() {
?>
</div><!-- .wide-container -->
<?php
}
renderstoreheaderontop()
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>
Customizer Settings
Getting Customizer Values
// 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'
Template Variables
Store Page (store.php)
| 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();
CSS Classes
Store Layout Classes
| 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 |
Container Classes
| Class | Element |
|---|---|
.container | Main container wrapper |
.dokan-store-wrap | Store content wrapper |
.store-page-wrap | Store page inner wrapper |
Template Overrides
Available Templates
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
Override Example
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' );
Removing Theme Modifications
Use Default Store Container
// 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>';
});
Dokan API Reference
Get Vendor Object
// 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 Methods
$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
WooCommerce Hooks Used
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' );
Yoast SEO Integration
The store template supports Yoast breadcrumbs:
if ( function_exists( 'yoast_breadcrumb' ) ) {
yoast_breadcrumb( '<p id="breadcrumbs">', '</p>' );
}
Related Documentation
- README – Technical overview
- Customer Guide – Setup instructions
- WooCommerce Hooks – WooCommerce customization
- Developer Hooks – All theme hooks
