• Resolved LynkUPP

    (@snnafrica)


    i have a multi-vendor ecommerce website without a payment gateway set up. I want buyers to contact vendors directly by phone and make enquiries and possible payment. How can I change the “add to cart” Button to “contact seller” And when the button is clicked, it will display the vendors phone contact?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @snnafrica

    This will require certain level of custom development.

    To change just the Add to cart text, you can use the following filters:

    • woocommerce_product_single_add_to_cart_text
    • woocommerce_product_add_to_cart_text
    function prefix_change_add_to_cart_text( $text ) {
        return esc_html__( 'Contact Seller', 'text-domain' );
    }
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'prefix_change_add_to_cart_text' );
    add_filter( 'woocommerce_product_add_to_cart_text', 'prefix_change_add_to_cart_text' );

    To change the Add to cart button HTML on the shop page, use the following filter:

    • woocommerce_loop_add_to_cart_link
    /**
     * This function will change the 'Add to cart' button HTML
     * on the shop page.
     */
    function prefix_change_add_to_cart_text( $button_html, $product, $args ) {
        return sprintf(
            '<button>%s</button>',
            esc_html__( 'Contact Seller', 'text-domain' )
        );
    }
    add_filter( 'woocommerce_loop_add_to_cart_link', 'prefix_change_add_to_cart_text', 10, 3 );

    This will at least help you get started.

    Using JavaScript, you will have to change the functionality of clicking the button and showing the seller’s contact information instead.

    You may need to hire a developer for this as this is related to customising WooCommerce core functionality.

    Thread Starter LynkUPP

    (@snnafrica)

    Where am I supposed to place the codes please? Function PHP?

    Plugin Support Beauty of Code (woo-hc)

    (@beautyofcode)

    Hi @snnafrica ,

    It is advised to add custom code via a plugin that allows custom functions to be added, such as the?Code Snippets?plugin.

    Alternatively, for help with custom code, you could hire a developer or ask your customisation questions in one of the channels below.

    I’d like to add that, based on what you have described, it may also be worth exploring either of the following extensions:

    Although it is not guaranteed that these will be compatible with your current multi-vendor plugin, this is something you can always double-check with the developer of the multi-vendor plugin you are currently using.

    WooCommerce.com offers a 30-day refund policy which you can take advantage of, allowing you to test the extension, and make sure that it is what you are looking for.

    Should you have any pre-sales related questions, kindly contact us directly at WooCommerce.com → My Account → Support. You will need to create an account if you do not have one already.

    Hope this helps!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to change “add to cart” To “Contact seller”’ is closed to new replies.