Author Topic: Shipment plugin custom JQuery problem  (Read 545 times)


  • Beginner
  • *
  • Posts: 5
  • A beginner
Shipment plugin custom JQuery problem
« on: September 28, 2022, 15:24:13 pm »
I'm using latest stable of Joomla and VM 3.x

I'm trying to use the following Jquery code in my shipment plugin:

Code: [Select]
$document = JFactory::getDocument();
                       jQuery(document).ready(function($) {
                        var $checkbox = $("#STsameAsBTjs");
                        if($("#shipment_id_'.$this->_currentMethod->virtuemart_shipmentmethod_id.'").prop("checked")) {
                            //alert("its checked");
                            $checkbox.prop("checked", false);

The idea is simple: if selected current shipment method then uncheck "Same as Billing" checkbox.

The code works, but only if the plugin's method is selected on the cart page reload. When clicking on the other methods and back to the plugin's one nothing happens. So I have two main questions:

1. How to make that code works every time user clicked on corresponding shipment method?

2. How to dynamically update the cart from custom Jquery code in a way it updates when selecting shipment/payment methods? For example, when "Same as Billing" checkbox unchecked by my code there is no shipping address showing below, but after change shipping/payment method cart updates and I see shipping address after that. I looked at dynupdate.js but can't figure out how to use Virtuemart.updForm in my code.

Appreciate any help with this :)