Plugin Author
Kokomo
(@kokomoweb)
Hi @jojithedevil,
absolutely. Simply paste the shortcode in any product description and it will automatically pull the list from that product.
HI Kokokmo, thank you! do you know what shortcode I would need to use if i am not wanting to use the product tag here. Can I use
[customer_list billing_first_name=”true” billing_last_name=”true”]
instead of
[customer_list product=”999″ billing_first_name=”true” billing_last_name=”true”]
where product is specified.
I want to just put this in single.php where it automatically pulls the list of customers who may have bought the product.
Could you please help me with it?
Thanks
Plugin Author
Kokomo
(@kokomoweb)
yes exactly. You’d have to paste the shortcode in the description of your product. Single.php is for articles so that won’t help you. If you are putting the shortcode in the wordpress single product template I am unsure if it will work, you might just add some code to get the current product ID and insert it in the shortcode using php.
Hi Kokomo,
Thank you for the reply. I have managed to get the shortcode working with
<?php echo do_shortcode('[customer_list product="570" show_titles="true" order_status="wc-completed" limit="9999" customer_display_name="true"]'); ?>
but the only problem is this wont work until i specify the product=”570″ tag. Do you know if I can remove that or replace it with something so it automatically uses product ID.
Thank you
Just to add I am using this on a WooCommerce Product Template.
When I remove the product tag its giving me this message.
This product currently has no customers
But when I use this with a product ID it shows me the list of customers without any problem
Plugin Author
Kokomo
(@kokomoweb)
Hi @jojithedevil,
Woocommerce has some functions to get the ID of the current product.
I haven’t tested it but this should work:
global $product;
$id = $product->get_id();
echo do_shortcode('[customer_list product="' . $id . '" show_titles="true" order_status="wc-completed" limit="9999" customer_display_name="true"]');