Okay
  Public Ticket #3821936
Offer and cart
Closed

Comments

  •  4
    hurtowniadachow started the conversation

    How to do it in the b2b king pro plugin so that after activating the offer and sending an individual inquiry, the products do not disappear from the cart but remain in it?

  •  2,361
    WebWizards replied

    Hi there,

    If I understand correctly, you would like it so that when a customer sends a quote request, the cart is not emptied?

    It should be possible to achieve this by adding the following PHP code snippet to the site:

    add_filter('b2bking_empty_cart_on_quote_request','__return_false');

     

    This can be added to functions.php or to any snippets plugin.

     

    Kind regards,

    Stefan

  •  4
    hurtowniadachow replied

    Unfortunately, the php function does not work, the basket still empties automatically after sending the query. I tried entering other codes and unfortunately none of them work. 

    -------------------------------

    function custom_prevent_empty_cart_on_quote_request($cart) {
        if (is_user_logged_in()) {
            return;
        }

        if (isset($_GET['action']) && $_GET['action'] == 'b2bking_quote_request') {
            return;
        }
    }

    add_action('woocommerce_cart_updated', 'custom_prevent_empty_cart_on_quote_request');

    --------------------------------

    add_filter('b2bking_quote_request_empty_cart', '__return_false');

    --------------------------------

    add_action('woocommerce_before_cart', 'prevent_cart_empty_on_quote_request', 10, 0);
    function prevent_cart_empty_on_quote_request() {
        if (isset($_GET['action']) && $_GET['action'] == 'b2bking_quote_request') {

            remove_action('woocommerce_cart_updated', 'woocommerce_cart_updated', 10);
        }
    }


    What's more, the conversation feature doesn't work properly, replies to custom offers don't work or reach customers, and the "Conversations" tab on the "my account" page doesn't work. Should I create a new page with some shortcode specifically for this purpose?

  •  2,361
    WebWizards replied

    Hi again,

    -> I tested that now on my local test site but it does seem to work as expected in my local tests. I took a quick video just to make sure we're looking at the same thing: https://www.loom.com/share/91a86740b0704ea0b5d86d9e59d42908?sid=1362e3f5-8a63-483b-9457-158fca751f6e

    So what I am seeing is that when a quote is requested, products are not removed from cart when that snippet is added to the site. 

    Is this behaving differently in your tests? I am not sure why, but it would be great if we could check and troubleshoot it. For that, would it be possible to share a backend access to the site or a staging clone site?

     

    -> "What's more, the conversation feature doesn't work properly, replies to custom offers don't work or reach customers,"

    Here are you specifically referring to the email not reaching customers? Is the conversation reply otherwise being saved correctly?

    If the problem is the email, what may be happening is that the email may be getting stopped by spam filters. To check for that, I would suggest to use an email log plugin like https://wordpress.org/plugins/wp-mail-logging/ to check whether the email exists in the log. If it does, it means it is being sent technically, but not reaching its destination.

    In that case, this is something that can be solved by installing and configuring a SMTP plugin: https://wordpress.org/plugins/wp-mail-smtp/. This is a very common issue for Woo sites.

     

    -> and the "Conversations" tab on the "my account" page doesn't work. Should I create a new page with some shortcode specifically for this purpose?

    No, this page is added automatically to 'my account'. Does that page show a 404 error? other pages such as "orders" work?

     

    Kind regards,

    Stefan

     

     

  •  4
    hurtowniadachow replied

    After removing the Litespeed Cache plugin and installing W3 Total Cache, several bugs were fixed, including the code that was supposed to not empty the cart after sending a quote request, now works.

    dodaj_filtr( 'b2bking_empty_cart_on_quote_request' , '__return_false' );