Support » Plugin: F4 Shipping Phone and E-Mail for WooCommerce » Show Phone field to vendor’s new order email

  • Resolved aliaslina

    (@aliaslina)


    Hello,
    I am trying to appear the Phone field to the vendor’s new order email, as it appears to the “New Order” email of the admin and the customer.

    Is there a certain code that I should add to the vendor’s template?

    Regards,
    Lina

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author F4

    (@faktorvier)

    Hi @aliaslina

    Which email do you mean exactly? Normally the field should appear in EVERY email that contains the customers shipping address.

    I am talking about the email that goes to the vendor in order to see his order (Vendor New order).

    You can see the difference between the admin email and the vendor email:
    https://ibb.co/7gzqjC8
    https://ibb.co/CmTxkpw

    Thank you in advance.

    Plugin Author F4

    (@faktorvier)

    So you mean the new order mail that goes to the shop owner I guess (in backend called “New Order”. We’ve tested that case, the phone field appears correctly in the address block. Maybe you got another plugin that has a conflict with our plugin? Also your links doesnt seem to work, I can’t see them.

    Hello again,

    Here are two links:
    https://ibb.co/HPJK6HK
    https://ibb.co/jWWDRkh

    Sorry for the inconvenience.
    Although, I will try to debug the issue by deactivating for plugins and I will let you know.

    Thank you for now.

    Plugin Author F4

    (@faktorvier)

    Hi

    Thanks for the screenshots, now I could take a look. Looks like you are using some kind of plugin for this vendor email. This plugin seems to remove the email and phone from both adresses and put the billing data above the address (Customer Details). If you tell us which plugin you are using, we can take a look if we can give you a code snippet that adds the shipping phone/email to the customer details. Maybe we can’t do this at all, but if we know which plugin you are using, we can at least take a look.

    Hello,

    First of all, thank you for your immediate response.

    As for the email, I have it hidden so this is not a problem. My only thing is with the phone which is a required field, for my site.

    Moreover, I am not using any plugin specifically for the vendor email, but I feel like the WCMp multi-vendor plugin has something to do with that option.

    If you have something in mind to fix this it would be great, as I feel that this kind of info should be displayed and in the vendor’s dashboard, as well.

    Thank you again for your cooperation.

    Plugin Author F4

    (@faktorvier)

    Thanks for the infos. This vendor email is a feature from the WCMp plugin you mentioned above, its not a WooCommerce core feature. Thats why I was confused which email you mean, because I don’t actually know this vendor plugin.

    I looked into the code and this the easiest solution to get the phone number displayed in this email is to copy the email template to your own theme and add a little bit code:

    1. Copy the the file “dc-woocommerce-multi-vendor/templates/emails/vendor-new-order.php” into your theme folder (yourtheme/dc-product-vendor/emails/plain/vendor-new-order.php)

    2. Add the following code

    <?php if($shipping_phone = get_post_meta($order->get_id(), '_shipping_phone', true)): ?>
    	<p><strong>Telephone (Shipping)</strong> <?php echo $shipping_phone; ?></p>
    <?php endif; ?>

    above the line <table id="addresses"..... into this file.

    That should add a new line with the shipping phone right under the normal phone number.

    This is not tested, because we can’t easily set up the whole vendor plugin for this case, but I’ll try to help you as good as I can if its not working.

    Thank you for your response, although it does not seems to work.

    Regards,
    Lina

    Plugin Author F4

    (@faktorvier)

    Is is just not working, or do you get any error messages/warnings?

    Is the copied template file working at all or is our code snippet from above not working? If you just write something like “Hello World!” in the copied template file, does this text appear in the email?

    Hello again,

    I added in my child theme the suggested file (yourtheme/dc-product-vendor/emails/plain/vendor-new-order.php) where I have changed the text in order to be sure that I am seeing the right file.

    Although, the snippet from above does not work at all.
    I have tried different versions (such as <?php echo get_post_meta($order->id, '_shipping_phone', true); ?> or <?php echo get_post_meta($order->get_id(), 'shipping_phone', true); ?>) and different lines, but nothing seems to work.

    Everything else is working, but it seems the template to totally ignore this piece of code.

    Plugin Author F4

    (@faktorvier)

    Thats very strange… As I said, I cant actually test this code in a vendor environment, but I tested it in a normal email. In a normal email (new order to the shop admin) the phone number is correctly displayed if I add it to the copied template file.

    There is only one thing left that comes to my mind, that you can try. Try this method:
    <?php echo $order->get_meta('_shipping_phone'); ?>

    If this is not working, then I’m out of ideas. Maybe the vendor plugin handles order meta in a way I don’t know, maybe the email is sent before we save the phone number to the order. I recommend asking the vendor plugin developers for advice, how you can output custom order meta like the phone number in their emails. Maybe they come up with a quick solution.

    Hello,

    I have just released this exact thing yesterday. The shipping phone field is not included in the order variable!

    So I will give it a try again with the plugin authors and if I make it to a solution I will let you know!

    Thank you so much for your help!

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.