/*
Theme Name:   Xstore child
Theme URI:    https://xstore.8theme.com
Description:  XStore is a multi-purpose theme that offers the ultimate WordPress and WooCommerce synergy, providing a comprehensive, all-in-one solution.
Author:       8theme
Author URI:   https://www.8theme.com
Template:     xstore
Version:      1.0
Text Domain:  xstore-child
Tags: e-commerce, two-columns, left-sidebar, right-sidebar, custom-background, custom-colors, custom-header, custom-menu, custom-logo, featured-images, full-width-template, threaded-comments, accessibility-ready, rtl-language-support, footer-widgets, sticky-post, theme-options, translation-ready, ecommerce, woocommerce, shop, elementor, business, corporate, blog, news, light, dark
*/


function stova_fix_xstore_brand_permission() {
    $role = get_role('fakur_mobile'); // replace with your client's role slug

    // Add a custom capability (safe and minimal)
    if ($role && !$role->has_cap('assign_xstore_brands')) {
        $role->add_cap('assign_xstore_brands');
    }

    // Hook into taxonomy registration to override the assign_terms cap
    add_action('init', function() {
        $taxonomy = get_taxonomy('brand'); // XStore uses 'brand' or 'xstore-brand', we’ll handle both
        if ($taxonomy) {
            $taxonomy->cap->assign_terms = 'assign_xstore_brands';
        }

        $taxonomy2 = get_taxonomy('xstore-brand');
        if ($taxonomy2) {
            $taxonomy2->cap->assign_terms = 'assign_xstore_brands';
        }
    }, 11);
}
add_action('init', 'stova_fix_xstore_brand_permission', 10);


