Public Ticket #3049291

Minimum Order Value - Ex VAT

Closed
Comments
1 Ticket
JonathanNP started the conversation 4 years ago on May 23, 2022 at 8:22am

Hi.

We are using the dynamic rule: minimum order value. But require the value to be set as an Excluding Tax value, and likewise, the warning notification in the cart, if the minimum value is not met, to display the current order total value as the cart subtotal / Ex Tax value.

Could you possibly provide a snippet that would amend the necessary to provide the function as needed?

Thanks


2,762
KingsPlugins replied 4 years ago on May 23, 2022 at 1:18pm

Hi Jonathan,

Thank you for purchasing our plugin,

You can add the following PHP code snippet to your site:

add_filter('b2bking_minmax_order_total_calculation_basis', function($val){
    return WC()->cart->cart_contents_total;
}, 10, 1);
add_filter('b2bking_minmax_value_display', function($val){
    return $val.' (vat excluded)';
}, 10, 1);

A PHP snippet can be added to functions.php, or by following our guide here: https://b2bkingplugin.com/docs/how-to-add-a-snippet-php-or-js/

This sets the minimum order value to be the value without vat + modifies the notification. For example:

1722469078.png

Kind regards,

Stefan

1 Ticket
JonathanNP replied 4 years ago on May 23, 2022 at 9:02pm

Hi Stefan

Thanks very much for your assistance and the quick reply and for providing the snippet. 

I've added and activated the snippet via the code snippets plugin but unfortunately, it doesn't seem to be taking effect. See screenshot. Is it perhaps due to the tax settings?

Thanks

1555898681.png

 

2,762
KingsPlugins replied 4 years ago on May 23, 2022 at 9:11pm

Could you please try to replace that snippet with the following?

add_action('plugins_loaded', function(){
    add_filter('b2bking_minmax_order_total_calculation_basis', function($val){
        return WC()->cart->cart_contents_total;
    }, 10, 1);
    add_filter('b2bking_minmax_value_display', function($val){
        return $val.' (vat excluded)';
    }, 10, 1);
});

If that doesn't work, would it be possible for you to share a backend login to your site or staging site, so we can look into it directly?

1 Ticket
JonathanNP replied 4 years ago on May 23, 2022 at 9:49pm

Unfortunately, that snippet hasn't worked either. We'll create an up to date staging site and send over details.

Thanks

2,762
KingsPlugins replied 4 years ago on May 25, 2022 at 11:27am

Thank you for the login,

I found that the plugin was a bit out of date and needed an update for this code to work, since the hooks have been added relatively recently. I've updated the B2BKing plugin in your site.

I tested and it seems to be working now:

7075666590.png


Please check and let me know.

Sign In