Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
1.3 kB
2
Indexable
add_action('plugins_loaded', function(){
	add_action('wp', function(){
		global $b2bking_public;
		remove_action( 'woocommerce_cart_actions', array($b2bking_public, 'b2bking_add_request_quote_button') );
		remove_action( 'woocommerce_blocks_enqueue_cart_block_scripts_after', array($b2bking_public, 'b2bking_add_request_quote_button') , 100000);
		
		if (!is_user_logged_in()){
			add_action( 'woocommerce_blocks_enqueue_cart_block_scripts_before', array($b2bking_public, 'b2bking_add_request_quote_button') , 100000);
		}
	});
});

add_action('wp_head', function(){
	?>
	<style>
	button#b2bking_request_custom_quote_button {
	    width: 100% !important;
	    margin-top: 20px;
	    background: #616161;
	    border: none;
	    color: white;
	    height: 40px;
	    font-weight: bold;
	    -webkit-font-smoothing: antialiased;
	}
	</style>
	<script>
		jQuery(document).ready(function(){
			setTimeout(function(){
				jQuery('.b2bking_custom_quote_field_container, #b2bking_request_custom_quote_textarea_abovetext, #b2bking_request_custom_quote_textarea').detach().insertBefore('.wc-block-cart__submit-container');
				jQuery('#b2bking_request_custom_quote_button').detach().insertBefore('.wc-block-cart__submit-container');
			}, 100);
		});
		
	</script>
	<?php	
});
Leave a Comment