• We work with your plugin for budgets and for some time now our code that interacted with your plugin for automatic budget approval no longer works. I thought it was my version of PHP but when validating on the plugin page I identified that the version is ok. Can you help me? The code apparently no longer works. See below for evaluation.

    // Função para aprovar automaticamente o orçamento quando um novo pedido é criado
    function approve_quotes_automatically($order_id) {
    $security_nonce = wp_create_nonce(‘qwc-update-status-security’);
    $security_nonce_send = wp_create_nonce(‘qwc-send-quote-security’);

    ?>
        <script>
            jQuery(document).ready(function ($) {
                let order_id = '<?php echo $order_id;?>';
                let security_nonce = '<?php echo $security_nonce;?>';
                let security_nonce_send = '<?php echo $security_nonce_send;?>';
    
                $.ajax({
                    type: 'POST',
                    url: ajaxurl,
                    data: {
                        'order_id': order_id,
                        'status': 'quote-complete',
                        'action': 'qwc_update_status',
                        'security_nonce': security_nonce
                    }, 
                    success: function(response) {
                        $.ajax({
                            type: 'POST',
                            url: ajaxurl,
                            data: {
                                'order_id': order_id,
                                'action': 'qwc_send_quote',
                                'security_nonce': security_nonce_send
                            }
                        });
                    }
                });
    
    
            });
    
        </script>
    <?php

    }

    add_action(‘woocommerce_thankyou’, ‘approve_quotes_automatically’, 10, 1);

Viewing 1 replies (of 1 total)
  • Plugin Author pinal.shah

    (@pinalshah)

    Hi @ocauemelo,

    The code looks fine. I had some queries:

    1. Can you kindly let me know the WC, WP and Quotes plugin versions?
    2. Any idea at which version did the custom code stop working?
    3. Have you observed that the code works fine for quote orders placed by registered users and does not work for quote orders placed by guest users?

    Thanks,

    Pinal

Viewing 1 replies (of 1 total)

The topic ‘automatic budget approval’ is closed to new replies.