Display Store Name in Shipping Packages
-
Maybe someone can help me out with this one. I’m looking to print the store name in each shipping package name. This is what I have so far:
add_filter(‘woocommerce_shipping_package_name’,’woocommerce_shipping_package_name_by_vendor’);
function woocommerce_shipping_package_name_by_vendor( )
{
$product = wc_get_product($package[‘contents’][0][‘product_id’]);
$author = get_user_by( ‘id’, $product->post->post_author );
$store_info = dokan_get_store_info( $author->ID );
$store_name = $store_info[‘store_name’];
return “Shipping from ” . $store_name;
}I’m not accessing the product ID correctly I don’t think, but I’m not entirely sure what I’m doing wrong. With the code: $package[“contents”][0][‘product_id’] I’m trying to access each package content’s first product’s ID to then get the author of that product and then get the dokan store name.
Thank you in advance!!!
- The topic ‘Display Store Name in Shipping Packages’ is closed to new replies.