Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    You shouldn’t edit core files. No snippets exist for this so if you need extra customisation in the backend you’ll need a developer.

    jobs.wordpress.net

    I mentioned in the other threads, we’re looking at this for future updates.

    Thread Starter pacikav

    (@pacikav)

    Hi Mike

    did not get you exactly

    No snippets exist for this so if you need extra customisation in the backend you’ll need a developer.

    Do you mean I need a developer who will override for me woocommerce files?

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Yes, ideally via custom javascript files which won’t be removed on update.

    Thread Starter pacikav

    (@pacikav)

    Mike

    Is it possible override woocomerce’s admin js files in theme?
    Or it should be like new plugin?
    Can you say which files can be affected ?

    Plugin Contributor Mike Jolley

    (@mikejolley)

    It can be added to a new plugin, and can either be JS based, or your plugin could maybe add a new button via PHP too.

    Can you say which files can be affected ?

    Not modifying files so it doesn’t matter.

    Thread Starter pacikav

    (@pacikav)

    Hi Mike

    Can you please with other issue?
    On my site I would like automatically calculate shippping tax depends on shipping sum.
    So I created js file and fire them with all admin scripts:

    functions.php

    add_action('admin_enqueue_scripts', 'admin_hooks');
        function admin_hooks( $hook ) {
            wp_enqueue_script( 'admin-hooks', get_template_directory_uri(). '/js/admin.hook.js' );
        }

    admin.hook.js

    jQuery( "input.line_total" ).on('focus', function() {
      	console.log('ad');
      });

    But when I click save this code doesn’t work until I refresh page.

    Thread Starter pacikav

    (@pacikav)

    Hi Mike

    Can you please with other issue?
    On my site I would like automatically calculate shippping tax depends on shipping sum.
    So I created js file and fire them with all admin scripts:

    functions.php

    add_action('admin_enqueue_scripts', 'admin_hooks');
        function admin_hooks( $hook ) {
            wp_enqueue_script( 'admin-hooks', get_template_directory_uri(). '/js/admin.hook.js' );
        }

    admin.hook.js

    jQuery( "input.line_total" ).on('focus', function() {
      	console.log('ad');
      });

    But when I click save this code doesn’t work until I refresh page.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    I suggest you look at the docs for jquery .on() – move the scope higher, since those elements will be removed/recreated.

    jQuery( document ).on( 'focus', "input.line_total", function() { .....
    Thread Starter pacikav

    (@pacikav)

    Thank you Mike
    That works.

    Thread Starter pacikav

    (@pacikav)

    Hi Mike

    As I said I have to do some calculation on order page in wp-admin.
    What the correcct way to get currency for current order?

    I found some way when I getting currency code and set as JS variable
    Then I can worj with this variable.

    add_action( 'woocommerce_before_order_itemmeta', 'before_order_itemmeta', 10, 3 );
    	function before_order_itemmeta( $item_id, $item, $_product ){
    			global $woocommerce;
    			$curr =  get_woocommerce_currency();
    			echo "<script type='text/javascript'>
    				currency_abbreviation = '".$curr."';
                    console.log(currency_abbreviation);
    			</script>";
    	}

    But it works not good, did not found why yet.
    Is it correct way?

    Plugin Contributor Claudio Sanches

    (@claudiosanches)

    You can get the current order currency using it:

    $order = wc_get_order( $post_id );
    $order->get_order_currency();
    
Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Disable confirmation alert’ is closed to new replies.