Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.1 kB
4
Indexable
Never
add_action('init', function(){
	global $b2bking_public;
	remove_shortcode('b2bking_csvorder', array($b2bking_public, 'b2bking_csvorder_shortcode_content'));
	add_shortcode('b2bking_csvorder', 'b2bking_csvorder_shortcode_content');
});
function b2bking_csvorder_shortcode_content(){
	ob_start();
	if (!current_user_can( apply_filters('b2bking_backend_capability_needed', 'manage_woocommerce') )){
		wc_print_notices();
	}
	?>
	<form method="post" enctype="multipart/form-data">
		<label for="b2bking_csvorder"><?php esc_html_e('Upload .csv files with SKU on first column and quantity on second column.','b2bking');?></label>
		<p class="form-row form-row-wide">
	        <span class="woocommerce-input-wrapper">
	            <input type="file" name="b2bking_csvorder" id="b2bking_csvorder" class="input-text" accept=".csv">
	        </span>
	    </p>
	    <button type="submit" class="button" name="b2bking_submit_csvorder"><?php echo apply_filters('b2bking_csvorder_add_text', esc_html__('Add to Cart','b2bking')); ?></button>
	</form>

	<?php
	$content = ob_get_contents();
	ob_end_clean();
	return $content;
}