Public Ticket #3643282

Change request_custom_quote_button

Closed
Comments
4 Tickets 5
Eduardo Andres started the conversation 2 years ago on May 7, 2024 at 11:58pm

I remove the procede to ckeckout button because I just want to use the custom_quote button , but I prefer to move the button to the right colum just below the totals summary , see image as example fromThis toThis.

Attached files:

2,762
KingsPlugins replied 2 years ago on May 8, 2024 at 3:51pm

Hello Eduardo,

I believe this can be achieved with a PHP code snippet.

I wrote the following code:

add_action('wp_head', function(){
    ?>
    <script>
        jQuery(document).ready(function(){
            jQuery('.actions > span.b2bking_request_custom_quote_text_label:nth-of-type(1)').detach().appendTo('.cart-collaterals');
            jQuery('#b2bking_request_custom_quote_name').detach().appendTo('.cart-collaterals');
            jQuery('.actions > span.b2bking_request_custom_quote_text_label:nth-of-type(1)').detach().appendTo('.cart-collaterals');
            jQuery('#b2bking_request_custom_quote_email').detach().appendTo('.cart-collaterals');
            jQuery('#b2bking_request_custom_quote_textarea_abovetext').detach().appendTo('.cart-collaterals');
            jQuery('#b2bking_request_custom_quote_textarea').detach().appendTo('.cart-collaterals');
            jQuery('.b2bking_custom_quote_field_container').detach().appendTo('.cart-collaterals');
            jQuery('#b2bking_request_custom_quote_button').detach().appendTo('.cart-collaterals');
        });
    </script>
    <?php
});

This snippet can be added to functions.php, or by following our guide here: https://b2bkingplugin.com/docs/how-to-add-a-snippet-php-or-js/

I tested the code in-browser and I believe it is working:

4119801860.png

Something I noticed is that the column 'TOTALES DEL CARRITO' is sticky and can overlap the quote area. To remove this sticky behaviour, you can add this CSS to the site:

.woocommerce-cart .is-sticky-column {
    position: initial !important;
}

Kind regards,

Stefan

2,762
KingsPlugins replied 2 years ago on May 8, 2024 at 4:46pm

Hmmm, this complicates the issue. In that case, a different approach may be needed, by changing the insertion hook of that button.

This is a bit dependent on each theme so it's hard to say what the best way to do it would be.

Is it possible to share a backend login to the site, or a staging site, so we can check it directly?

2,762
KingsPlugins replied 2 years ago on May 9, 2024 at 2:17am

Thank you for the access details,

I have made a change to that snippet and set it to the following:

add_action('wp', function(){
    global $b2bking_public;
    remove_action( 'woocommerce_cart_actions', array($b2bking_public, 'b2bking_add_request_quote_button') );
    add_action('woocommerce_after_cart_totals', array($b2bking_public, 'b2bking_add_request_quote_button'), 10000 );
});
add_action('plugins_loaded', function(){
    global $b2bking_public;
    remove_action( 'woocommerce_cart_actions', array($b2bking_public, 'b2bking_add_request_quote_button') );
    add_action('wp', function(){
        global $b2bking_public;
        remove_action( 'woocommerce_cart_actions', array($b2bking_public, 'b2bking_add_request_quote_button') );
    });
});

That seems to be working now. Let me know if you see any further issues.

Sign In