• chiragzinzuvadiya

    (@chiragzinzuvadiya)


    Hi Keylor,

    I’ve tried above solution but it didn’t work for me I think it doesn’t add the store name in the database so when I’m trying to fetch the value it returns as empty string and in the mail instead of store name it displays the only label we’ve set for an option like below.

    Shipping: Pickup at a Store

    So can you please help me to resolve this issue?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Keylor Mendoza

    (@keylorcr)

    Hi @chiragzinzuvadiya

    Based on the previous solution I had recommended, I’ve written this little snippet where you can get custom fields from stores and then add them to the email notice, in this case, right after the order table.

    function custom_order_details_after_order_table($order) {
        $order_id = $order->get_id();
        $store_name = get_post_meta($order_id, '_shipping_pickup_stores', true); // Get store title for this order
        $store = get_page_by_title($store_name, OBJECT, 'store');
        $store_phone = get_post_meta($store->ID, 'phone', true);
        ?>
        <p class="details"><strong><?= __('Phone Number', 'text_domain') ?>:</strong> <?= $store_phone ?></p>
        <?php
    }
    add_action('woocommerce_email_after_order_table', 'custom_order_details_after_order_table');

    I hope this can help you

    Keep in touch

    Regards

    This works like a charm. So, this is a resolved topics for me ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Store name not displaying in email’ is closed to new replies.