-
AuthorPosts
-
May 16, 2016 at 10:45 pm #633351
I’ve been trying to implement a third party plugin to allow fractional quantity in WooCommerce and having problems. It’s called WooCommerce Advanced Quantity:
http://codecanyon.net/item/woocommerce-advanced-quantity/11861326
In the comments for this plugin, they point to Enfold as the issue with the plugin not working properly.
I get that everyone could point fingers on why this issue is occuring but I just need to be able to use fractional quantities. Is there a way to disable to +/- quantity feature Enfold implements and go back to the quantity dropdown that’s standard in WooCommerce without hacking Enfold? That is, can I do it via a hook or something?
Thanks!
May 18, 2016 at 10:08 am #634266Hi,
Open /enfold/config-woocommerce/woocommerce-mod.js and remove the following:
jQuery(".quantity input[type=number]").each(function() { var number = $(this), max = parseFloat( number.attr( 'max' ) ), min = parseFloat( number.attr( 'min' ) ), step = parseInt( number.attr( 'step' ), 10 ), newNum = jQuery(jQuery(' <div />').append(number.clone(true)).html().replace('number','text')).insertAfter(number); number.remove(); setTimeout(function(){ if(newNum.next('.plus').length == 0) { var minus = jQuery('<input type="button" value="-" class="minus">').insertBefore(newNum), plus = jQuery('<input type="button" value="+" class="plus">').insertAfter(newNum); minus.on('click', function(){ var the_val = parseInt( newNum.val(), 10 ) - step; the_val = the_val < 0 ? 0 : the_val; the_val = the_val < min ? min : the_val; newNum.val(the_val); }); plus.on('click', function(){ var the_val = parseInt( newNum.val(), 10 ) + step; the_val = the_val > max ? max : the_val; newNum.val(the_val); }); } },10); });
Regards,
JosueJune 2, 2016 at 6:08 am #641842Just so I’m clear, there’s no way to do this without modifying a core theme file? Or at least overriding it in a child theme?
I know this is probably best added as a feature request but is there any way to compare a child theme and its parent and identify outdated files in the child theme?
June 2, 2016 at 4:05 pm #642133Hi,
You could dequeue the parent file with a function like this:
function wp_dequeue_avia_wc() { wp_dequeue_script( 'avia-woocommerce-js' ); } add_action( 'wp_print_scripts', 'wp_dequeue_avia_wc', 100 );
Best regards,
JosueSeptember 3, 2016 at 11:31 pm #681709I have an issue with this code, my problem was that I don’t have step attribute on the input so when I click on “+” or “-” the result was NaN because the step is null in my case.
To resolve that I copy the actual javascript to my child theme and modify 2 lines off code :
In woocommer-mod.js line 22 (I add “|| 1” to get ride of the null or undefined value):
step = parseInt( number.attr( 'step' ), 10 ) || 1,
And line 24 I add this :
number.remove(); newNum.removeAttr('pattern');
To load this new script and unload the core one :
function wp_dequeue_avia_wc() { wp_dequeue_script( 'avia-woocommerce-js' ); } function wp_enqueue_avia_wc() { wp_enqueue_script('avia-woocommerce-js2', get_stylesheet_directory_uri() . '/config-woocommerce/woocommerce-mod.js', array('jquery'), 1, true); } add_action( 'wp_print_scripts', 'wp_dequeue_avia_wc', 100 ); add_action( 'wp_enqueue_scripts', 'wp_enqueue_avia_wc' );
- This reply was modified 8 years, 2 months ago by prometee. Reason: format
September 6, 2016 at 4:50 pm #682726January 12, 2017 at 12:32 pm #732609I’m using the “Quantities and Units for WooCommerce” plugin to enable decimal quantities and Kg as units.
I disabled the Enfold +/- as suggested by Josue in his first answer but this is not sufficient since:
– the quantity field is classified as a Text input field instead of a number input field (as you can see the std increase and decrease HTML buttons are not appearing also in the cart )
– the header cart show quantities with ‘.’ instead of ‘,’
https://drive.google.com/file/d/0B7baurTblFiQQWloLUVmeEJCN2M/view?usp=sharing
https://drive.google.com/file/d/0B7baurTblFiQX0x0X2pwRGF1V1U/view?usp=sharing- This reply was modified 7 years, 10 months ago by tipinoncomuni. Reason: Question about decimal separator moved here https://kriesi.at/support/topic/decimal-point-in-woocommerce-product-quantities/
January 16, 2017 at 5:26 pm #734222@tipinoncomuni
Please contact WooCommerce about this issue. Have you got similar results when using a default WP theme?Please post us your login credentials (in the “private data” field), so we can take a look at your backend.
Login credentials include:
- The URL to the login screen.
- A valid username (with full administration capabilities).
- As well as a password for that username.
- permission to deactivate plugins if necessary.
Best regards,
AndyJanuary 17, 2017 at 12:36 am #734406Theme: Twenty Seventeen
Plugin: enabled
the HTML +/- buttons are revealed, fractional quantities can be saved to cartTheme: Enfold
Plugin: enabled
the Enfold +/- buttons are not working, manual input with fractional quantities is not accepted by pageTheme: Enfold child with Josua code to disable Enfold +/- buttons
Plugin: enabled
Enfold +/- buttons are disappeared
The HTML +/- buttons are not revealed, manual input with fractional quantities is accepted by page
The decimal separator in the header cart is wrong (‘.’ instead of ‘,’ as defined in woocommerce config)Obviously, the fractional quantities directly supported by Enfold +/- buttons … is the desired solution :-)
Fractional quantities question moved HERE
- This reply was modified 7 years, 10 months ago by tipinoncomuni. Reason: deleted access info
January 17, 2017 at 1:59 am #734426Hey!
@tipinoncomuni Can you please start a new thread and attach these WP logins and FTP login? If you post them here, they will be visible to creator of this thread as well.Best regards,
Yigit -
AuthorPosts
- You must be logged in to reply to this topic.