Okay
  Public Ticket #3643282
Change request_custom_quote_button
Closed

Comments

  •  5
    Eduardo Andres started the conversation

    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:  FromThis.png
      ToTHis.png

  •  2,038
    WebWizards replied

    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://woocommerce-b2b-plugin.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


  •  5
    Eduardo Andres replied

    It works , but if I update product Quantitys on CarUpdate Button get Duplicate see image atached.

    Attached files:  NeedFix.png

  •  2,038
    WebWizards replied

    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?

  •   Eduardo Andres replied privately
  •  2,038
    WebWizards replied

    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.

  •  5
    Eduardo Andres replied

    Yes is working now thanks a lot :)