Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter albertodominguezt

    (@albertodominguezt)

    @woosms Any ideas?

    Thread Starter albertodominguezt

    (@albertodominguezt)

    Hello again @rermis .

    For some reason the buttons show up but disappear right away.

    here is a link to a video a recorded.
    https://www.dropbox.com/s/dhk9g8zyt9wvtu7/Los%20Deditos%20De%20Mary%20-%20Google%20Chrome%202020-07-09%2016-29-19.mp4?dl=0

    Thread Starter albertodominguezt

    (@albertodominguezt)

    Here is the Original templeate (tbody only) of the review-order-opc.php

    
    <tbody>
    			<?php
    				do_action( 'woocommerce_review_order_before_cart_contents' );
    
    				foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
    					$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
    
    					if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
    						?>
    						<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item opc_cart_item', $cart_item, $cart_item_key ) ); ?>" data-add_to_cart="<?php echo $_product->get_id(); ?>" data-update_key="<?php echo $cart_item_key; ?>">
    							<td class="product-name">
    								<div class="product-remove" >
    									<?php echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf( '<a href="%s" class="remove" title="%s">&times;</a>', esc_url( wcopc_get_cart_remove_url( $cart_item_key ) ), __( 'Remove this item', 'wcopc' ) ), $cart_item_key ); ?>
    								</div>
    								<div class="product-details" >
    									<?php echo apply_filters( 'woocommerce_cart_item_name', wcopc_get_products_name( $_product ), $cart_item, $cart_item_key ); ?>
    									<?php echo wcopc_get_formatted_cart_item_data( $cart_item ); ?>
    								</div>
    								<div class="product-quantity">
    								<?php
    									if ( $_product->is_sold_individually() ) {
    										$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
    									} else {
    										$product_quantity = woocommerce_quantity_input( array(
    											'input_name'  => "cart[{$cart_item_key}][qty]",
    											'input_value' => $cart_item['quantity'],
    											'max_value'   => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(),
    											'min_value'   => '0'
    										), $_product, false );
    									}
    
    									echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
    								?>
    								</div>
    							</td>
    							<td class="product-total">
    								<?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
    							</td>
    						</tr>
    						<?php
    					}
    				}
    
    				do_action( 'woocommerce_review_order_after_cart_contents' );
    			?>
    </tbody>
    

    I had to edit it and added:
    do_action( 'woocommerce_after_cart_item_quantity' );

    right after:
    echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );

    so that the button appear in the desired position.

    Thread Starter albertodominguezt

    (@albertodominguezt)

    Hello @rermis ! it did worked! Thanks

    but i had to change the hook action location so it would appear correctly….

    //add_action('woocommerce_after_cart','wqb_cart');
    add_action('woocommerce_review_order_after_cart_contents','wqb_cart');

    AND

    //add_action('woocommerce_after_add_to_cart_quantity','wqb_assets');
    add_action('woocommerce_review_order_after_cart_contents','wqb_assets');
    Thread Starter albertodominguezt

    (@albertodominguezt)

    From my point of view, ( im not an expert on JS) this function is not updating the field correctly, or the update js function is not getting the new value.

        function wqb_action(iteration,q) {
          var qty=[].slice.call(document.querySelectorAll('div.quantity'));
          if(!qty) return;
          for(i=0; i<qty.length; i++) if(i==iteration) {
            v=qty[i].childNodes[3];
            if(!v) return;
            if(v.value<=1 && q<1) return;
            v.value=parseInt(v.value)+parseInt(q);
          }
    
Viewing 5 replies - 1 through 5 (of 5 total)