I'm currently setting up the B2B King on our website. Is it possible to add a "start conversation" or "send message" button in the product page? From what I can see, to start a conversation or send a message to the admin, the user must leave the product page and go to the my account page to start a conversation.
Is there anyway we can add a "start conversation" button on the product page so that the admin knows that the client's question is relative to that specific product? Like a quote, but it's a chat.
I've been looking into the best way to implement that.
Are you currently using quote requests on the product page? If not, I think a great option is to adapt the quote on product page functionality. You can add this PHP snippet to your site: https://pastecode.io/s/u5y9sxwj
In order to use quote requests on the product page, do I have to activate any option in the settings page? Or is it enough to add the code snippet that you have sent me?
I've enabled quote requests in the settings: https://prnt.sc/8yRvi_UVBKG-
However, after creating the code snippet that you've sent me and adding it to the product template page, the "send inquiry" button is not showing. Maybe we can create a new button with HTML and add it to the page?
I managed to make it work by adding the [b2bking_quote_form type=form] shortcode that you provided in the docs.
However, how can we change the title of the conversation that is being opened? I know the type is "Custom Quote Request" but the title is also showing "Custom Quote Request".
How can we change the title of the conversation that is being opened? I'm asking this because I'm using the custom request form on the product page but I'm also using it in the contacts page. So the title of the conversation should be "Request from Product Page" or "Request from Contacts Page".
To change the title of the quote request based on the location it's requested from, you can add this PHP snippet to your site:
add_filter('b2bking_request_quote_title', function($title) {
$location = sanitize_text_field($_POST['location']);
if ($location === 'productpage') {
$title = 'Request from Product Page';
}
if ($location === 'shortcode') {
$title = 'Request from Contact Page';
}
return $title;
}, 10, 1);
I think the above should work but it can depend on where you add the shortcode. Usually "productpage" is the location when on a single product page, and "shortcode" is on other pages.
I added a form field in the custom request page called "Reason for contacting" (warranty, doubts, etc.). Is it possible to add that "reason" field to the title?
Yes, it is possible to add that field to the title. To do it, change the snippet to this:
add_filter('b2bking_request_quote_title', function($title) {
$location = sanitize_text_field($_POST['location']);
if ($location === 'productpage') {
$title = 'Request from Product Page';
}
if ($location === 'shortcode') {
$title = 'Request from Contact Page';
}
if (isset($_POST['b2bking_field_1234'])){
$title .= ' - '.$_POST['b2bking_field_1234'];
}
return $title;
}, 10, 1);
It is needed to replace 1234 with the ID of that reason field. To get that ID, just edit the field in the backend, and check the number in the URL (e.g. ?post=1234).
So for example on my site I have
then it should be "b2bking_field_483" in the code snippet.
Hello!
I'm currently setting up the B2B King on our website. Is it possible to add a "start conversation" or "send message" button in the product page? From what I can see, to start a conversation or send a message to the admin, the user must leave the product page and go to the my account page to start a conversation.
Is there anyway we can add a "start conversation" button on the product page so that the admin knows that the client's question is relative to that specific product? Like a quote, but it's a chat.
Best regards and thanks!
Hello Miguel,
Thank you for purchasing our plugin,
While B2BKing does not have a built-in feature for that, I believe we can help write a code snippet to achieve it.
I can suggest 2 options:
(A) We could add a button like this near the add-to-cart button:
(B) I think we could also add something like a tab, similar to this, near the other tabs like 'Description':
Does one of these sound like what you're looking for and if so, what would you prefer? Let me know and I will then start to work on that snippet.
Kind regards,
Stefan
Hi!
Thanks for the quick reply.
I believe option A may be what I'm looking for.
Can you please tell me how I can make this through a code snippet?
And will the inquiry save the product information so that the B2B manager knows which product the message was sent from?
Hope to hear from you soon. Best regards and thanks
Thank you for confirming that,
I've been looking into the best way to implement that.
Are you currently using quote requests on the product page? If not, I think a great option is to adapt the quote on product page functionality. You can add this PHP snippet to your site: https://pastecode.io/s/u5y9sxwj
It would then work as follows: https://www.loom.com/share/e07d2973fa8646c281f1505b7529c289?sid=0e6af597-d723-4378-9675-c26c1a33c390 (we can make small adjustments to texts / wording if needed).
Kind regards,
Stefan
Hi Stefan,
In order to use quote requests on the product page, do I have to activate any option in the settings page? Or is it enough to add the code snippet that you have sent me?
Best regards and thanks
Hello Miguel,
Great question, I forgot to mention that as well,
It looks like you would need one of these options enabled in B2BKing -> Settings -> Quotes:
Let me know if you run into any issue,
Kind regards,
Stefan
Hi Stefan,
Sorry for the late response.
I've enabled quote requests in the settings: https://prnt.sc/8yRvi_UVBKG-
However, after creating the code snippet that you've sent me and adding it to the product template page, the "send inquiry" button is not showing. Maybe we can create a new button with HTML and add it to the page?
https://prnt.sc/VzfH1IrLImAS
I can create a guest user for you to inspect it if you want.
Hi Stefan!
I managed to make it work by adding the [b2bking_quote_form type=form] shortcode that you provided in the docs.
However, how can we change the title of the conversation that is being opened? I know the type is "Custom Quote Request" but the title is also showing "Custom Quote Request".
How can we change the title of the conversation that is being opened? I'm asking this because I'm using the custom request form on the product page but I'm also using it in the contacts page. So the title of the conversation should be "Request from Product Page" or "Request from Contacts Page".
https://prnt.sc/DwiNb5oMXi9A
Best regards and thanks!
Hello Miguel,
To change the title of the quote request based on the location it's requested from, you can add this PHP snippet to your site:
I think the above should work but it can depend on where you add the shortcode. Usually "productpage" is the location when on a single product page, and "shortcode" is on other pages.
Let me know if that works for you as needed.
In my tests I see:
Hi Stefan!
It's working totally fine!
I added a form field in the custom request page called "Reason for contacting" (warranty, doubts, etc.).
Is it possible to add that "reason" field to the title?
Example:
Best regards and thanks!
Yes, it is possible to add that field to the title. To do it, change the snippet to this:
It is needed to replace 1234 with the ID of that reason field. To get that ID, just edit the field in the backend, and check the number in the URL (e.g. ?post=1234).
So for example on my site I have
then it should be "b2bking_field_483" in the code snippet.
Let me know if you have any issues,