Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

Add the name of the seller to the cart and on the checkout page

add_action('init', 'mvx_change_sold_by_cart_checkout');
function mvx_change_sold_by_cart_checkout(){
global $mvx;
 remove_action('woocommerce_get_item_data', array($mvx->vendor_caps, 'add_sold_by_text_cart'), 30, 2);
 add_action('woocommerce_get_item_data', 'add_sold_by_text_cart', 30, 2);
}

function add_sold_by_text_cart($array, $cart_item) {
    if ('Enable' === get_mvx_vendor_settings('sold_by_catalog', 'general') && apply_filters('mvx_sold_by_text_in_cart_checkout', true, $cart_item['product_id'])) {
        $vendor = get_mvx_product_vendors($cart_item['product_id']);
        if ($vendor) {
            echo  '<br>' . $vendor->page_title;
            do_action('after_sold_by_text_cart_page', $vendor);
        }
    }
    return $array;
}

Leave a Reply