• Resolved davidperezh

    (@davidperezh)


    Hi,
    I would like to able to display the store address in checkout page when local pickup shipment method is selected.
    By default appears “Local pickup” and doesn’t give information to the customer where to pickup the order.
    Can you provide the code or plugin to have this feature?
    I think that for local pickup is strongly necessary to inform the customer where to pickup the order.
    I’ve tried with the following code, but only obtain to display this information in each cart product, and I would like to display in the shipment field:
    add_action( ‘woocommerce_add_order_item_meta’, ‘dp_add_vendor_to_order_item_meta’, 10, 2);
    function dp_add_vendor_to_order_item_meta( $item_id, $cart_item) {
    $vendor_id = $cart_item[ ‘data’ ]->post->post_author;
    // build up address
    $address1 = get_user_meta( $vendor_id , ‘billing_address_1’, true );
    $address2 = get_user_meta( $vendor_id , ‘billing_address_2’, true );
    $city = get_user_meta( $vendor_id , ‘billing_city’, true );
    $store_postcode = get_user_meta( $vendor_id , ‘billing_postcode’, true );
    $state = get_user_meta( $vendor_id , ‘billing_state’, true );
    $address = ( $address1 != ”) ? $address1 .’, ‘ . $city .’, ‘ . $state.’, ‘. $store_postcode :”;

    wc_add_order_item_meta( $item_id, apply_filters(‘vendors_sold_by_in_email’, __(‘Recoger en’, ‘vendors’)), $address);
    }
    add_action( ‘woocommerce_add_order_item_meta’, ’email_add_vendor_to_order_item_meta’, 10, 3);
    function email_add_vendor_to_order_item_meta( $item_id, $cart_item) {
    $vendor_id = $cart_item[ ‘data’ ]->post->post_author;
    $email_vendor = get_userdata( $vendor_id )->user_email;

    wc_add_order_item_meta( $item_id, apply_filters(‘vendors_sold_by_in_email’, __(‘Email’, ‘vendors’)), $email_vendor);
    }

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Mark Kevin

    (@mkesteban08)

    Hi @davidperezh

    Please take note that we don’t have any controls regarding the local pickup functionality from WooCommerce. All details that it is fetching would be from the marketplace and not from the individual vendors by default.

    Furthermore, if you would need to display the details in the checkout page, please consider hooking into the checkout page – woocommerce_review_order_after_shipping
    instead of here – woocommerce_add_order_item_meta

    I hope that this could help. Have a nice day ahead!

    Thread Starter davidperezh

    (@davidperezh)

    Hi Mark,
    Thank you for your valuable information.
    Unfortunately, I did it before writing in this forum.
    If I replace the hook by woocommerce_review_order_after_shipping, the checkout page keeps on loading indefinetely; doesn’t work.
    Maybe I have to replace other parts of the given code in order to avoid this fatal result, and proceed with the checkout.
    I know that this concerns to WooCommerce and not WC Vendors, but I think could be a good solution to have this feature, due lots of shops want to offer the pickup service, and because the Covid-19 this quantity has increased a lot.
    Could you kindly help me to find the right solution?
    Otherwise I can’t offer the vendors the feature of show their stores address to let the customers pick up their orders.
    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display store address in checkout’ is closed to new replies.