Dokan Hooks Reference

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


buddyxstorecontainer_close

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

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)

VariableTypeDescription
$store_userobjectDokan vendor object
$store_infoarrayStore information
$map_locationstringStore location
$layoutstringSidebar layout
$positionstringHeader 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

ClassApplied When
.layout-leftLeft sidebar layout
.layout-rightRight sidebar layout
.dokan-single-storeMain store container
.dokan-single-store-topStore header at top

Container Classes

ClassElement
.containerMain container wrapper
.dokan-store-wrapStore content wrapper
.store-page-wrapStore 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

Last updated: January 31, 2026