• I tried to resolve some jquery and other issues and I was able to but it’s still isn’t that compatible it will be great if the devs will update it to support for latest version.
    @vgstudios Can you please tell how you get it to work? Link

Viewing 3 replies - 1 through 3 (of 3 total)
  • Not sure if this is sufficient for you, but that’s what we did:

    diff --git a/src/themeszone-woocommerce-ajax-quantity/public/js/tz-wc-ajax-qty-public.js b/dst/themeszone-woocommerce-ajax-quantity-vgs/public/js/tz-wc-ajax-qty-public.js
    index cdde308..c21d751 100644
    --- a/src/themeszone-woocommerce-ajax-quantity/public/js/tz-wc-ajax-qty-public.js
    +++ b/dst/themeszone-woocommerce-ajax-quantity-vgs/public/js/tz-wc-ajax-qty-public.js
    @@ -1,13 +1,13 @@
     (function( $ ) {
     	'use strict';
     
    -	$( window ).load(function() {
    +	$( window ).on('load', function() {
     
     		if ( typeof tz_call === 'undefined' ) {
     			return false;
     		}
     
    -		$('.tz-qty-cont').live('click', function(){
    +		$('body').on('click', '.tz-qty-cont', function(){
     
     			var qty_input = $(this).parent().find('input[name="quantity"]');
     			if ( $(qty_input).prop('disabled') ) return;
    @@ -40,9 +40,9 @@
     				'tz_qty_get_form_data': data      // We pass php values differently!
     			};
     
    -			var qty_form = $(sender).parents('li.product').find('.tz-qty-container');
    -			var pos = $(sender).parents('li.product').find('a.button[data-tz_qty_ajax="true"]');
    -			var vv = $(sender).parents('li.product').find('a.added_to_cart');
    +			var qty_form = $(sender).parents('.w-grid-item.type-product').find('.tz-qty-container');
    +			var pos = $(sender).parents('.w-grid-item.type-product').find('a.button[data-tz_qty_ajax="true"]');
    +			var vv = $(sender).parents('.w-grid-item.type-product').find('a.added_to_cart');
     			if ( pos.length && qty_form.length ) {
     				pos.hide();
     				vv.remove();
    @@ -50,7 +50,6 @@
     				qty_form.removeClass('hidden');
     				qty_form.show();
                 }
    -
     		});
     
     		$ ( document.body ).on('added_to_cart', function(env, fragments, cart_hash, $thisbutton){
    @@ -59,8 +58,8 @@
     				$.post(tz_call.ajax_call_path, tz_qty_query, function(response, status) {
     					if ( status == 'success' ) {
     
    -						var qty_form = $thisbutton.parents('li.product').find('.tz-qty-container');
    -						var h_field = $thisbutton.parents('li.product').find('input[data-product_id]');
    +						var qty_form = $thisbutton.parents('.w-grid-item.type-product').find('.tz-qty-container');
    +						var h_field = $thisbutton.parents('.w-grid-item.type-product').find('input[data-product_id]');
     						$(h_field).data('cart_id', response.cart_id);
     						var inp = qty_form.find('input.qty');
     						$(inp).val(response.qty);
    @@ -78,11 +77,11 @@
     			$( document.body ).trigger('after_adding_to_cart', [ obj, data ] );
     		});
     
    -		$( '.tz-qty-container .quantity input.qty' ).live( 'change', function() {
    +		$('body').on('change', '.tz-qty-container .quantity input.qty', function() {
     
     			if ( $(this).prop('disabled') ) return;
     
    -			var inputattrs = $(this).parents('li.product').find('input[data-product_id]');
    +			var inputattrs = $(this).parents('.w-grid-item.type-product').find('input[data-product_id]');
     
     			var args = {};
     
    @@ -93,8 +92,8 @@
     			args['qty'] = parseFloat($(this).val());
     			var cur_qty = args['qty'];
     
    -			var buy_but = $(this).parents('li.product').find('a.add_to_cart_button');
    -			var qty_form = $(this).parents('li.product').find('div.tz-qty-container');
    +			var buy_but = $(this).parents('.w-grid-item.type-product').find('a.add_to_cart_button');
    +			var qty_form = $(this).parents('.w-grid-item.type-product').find('div.tz-qty-container');
     
     
     
    @@ -159,6 +158,7 @@
     
     				// Trigger event so themes can refresh other areas
     				$( document.body ).trigger( 'cart_qty_update', [ fragments, cart_hash ] );
    +				$( document.body ).trigger( 'wc_fragments_refreshed' );
     
     			});
     
    @@ -169,7 +169,7 @@
                	var removed_product = args.context.dataset.product_id;
                	var product_removed_button = $('[data-product_id="'+removed_product+'"]')
     		   	if ( product_removed_button.length && product_removed_button[0].hasAttribute('data-tz_qty_ajax') ) {
    -           		var product_container = product_removed_button.parents('li.product');
    +           		var product_container = product_removed_button.parents('.w-grid-item.type-product');
                		if ( product_container.length ) {
                			var inp = product_container.find('.tz-qty-container .quantity input.qty');
                         inp.val(0);
    diff --git a/src/themeszone-woocommerce-ajax-quantity/templates/qty-form.php b/dst/themeszone-woocommerce-ajax-quantity-vgs/templates/qty-form.php
    index 1e72b95..3a14b4f 100644
    --- a/src/themeszone-woocommerce-ajax-quantity/templates/qty-form.php
    +++ b/dst/themeszone-woocommerce-ajax-quantity-vgs/templates/qty-form.php
    @@ -1,6 +1,6 @@
     <?php global $cart_item_info, $product, $form_visible, $link; ?>
     <div class="tz-qty-container <?php echo ( $form_visible ) ? '' : 'hidden'; ?>">
    -	<span class="tz-qty-cont minus">-</span>
    +	<span class="tz-qty-cont plus">+</span>
     	<?php
     	$cur_qty = isset($_POST['quantity']) ? wc_stock_amount( $_POST['quantity'] ): wc_stock_amount ( $cart_item_info['qty']) ;
     	woocommerce_quantity_input( array(
    @@ -11,5 +11,5 @@
     	) );
     	echo sprintf( '<input type="hidden" data-product_id="%s" data-product_sku="%s"  data-cart_id="%s" class="%s hidden button product_type_simple">', esc_attr( $product->get_id() ), esc_attr( $product->get_sku() ),  esc_attr($cart_item_info['key']) ,esc_attr( $link['class'] ) );
     	?>
    -	<span class="tz-qty-cont plus">+</span>
    +	<span class="tz-qty-cont minus">-</span>
     </div>
    \ No newline at end of file
    diff --git a/src/themeszone-woocommerce-ajax-quantity/themeszone-wc-ajax-qty.php b/dst/themeszone-woocommerce-ajax-quantity-vgs/themeszone-wc-ajax-qty.php
    index 4e2fe5e..f79c9d0 100644
    --- a/src/themeszone-woocommerce-ajax-quantity/themeszone-wc-ajax-qty.php
    +++ b/dst/themeszone-woocommerce-ajax-quantity-vgs/themeszone-wc-ajax-qty.php
    @@ -13,10 +13,10 @@
      * @package           TZ_WC_Ajax_Qty
      *
      * @wordpress-plugin
    - * Plugin Name:       Themes Zone WC Ajax Quantity
    + * Plugin Name:       Themes Zone WC Ajax Quantity (Vagas VGS mod)
      * Plugin URI:        https://themes.zone/themes-zone-woocommerce-ajax-quantity-plugin/
      * Description:       Plugin adds a quantity filed on product listing page when customer clicks on add to cart button, thus allowing customers to change product quantity without having to go to the shopping cart to change the number of products.
    - * Version:           1.2.2
    + * Version:           1.2.3
      * Author:            Themes Zone
      * Author URI:        https://themes.zone/
      * License:           GPL-2.0+
    

    You will need to adjust .w-grid-item.type-product to the actual value for yout theme, this is for the Impreza theme we use on that site.

    Also probably you won’t need to swap plus and minus like us, since this is for an RTL site.

    Thread Starter dada84

    (@dada84)

    @vgstudios Thank You so much I modified this plugin and it worked very properly on a new woocommerce installation with built in theme but it doesn’t seems to work with my theme maybe I will still have to wait for update by official devs.

    Hello @vgstudios ,

    I’m really new to programming can you suggest/help to make it work for woocommerce 5+?

    Or Just Tell me where to add given codes..

    thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Regarding Update’ is closed to new replies.