Community Forums › Forums › Archived Forums › Design Tips and Tricks › Product quantity not displaying correctly in cart
- This topic has 7 replies, 3 voices, and was last updated 8 years, 7 months ago by
frobin.
-
AuthorPosts
-
March 1, 2016 at 10:47 am #180338
EmLY14
MemberI am working with Cafe Pro and Woocommerce on a retail site. I am experiencing an issue with the quantity of products displayed in the cart.
There is no issue in selecting any number of products but when viewing in the cart the quantity will only display '1' in the box, however the price will reflect how many have been selected. This is confusing to the consumer. If any of you have experienced this before or are happy to share any tips with me I would be hugely grateful.
Thanks in advance.
http://www.onwardtrading.comMarch 2, 2016 at 7:45 am #180429Victor Font
ModeratorDo you have any filters set in functions.php to set default quantities. Look for code in your functions file that resembles the code below to work with the woocommerce_quantity_input_args filter. Code like this will always reset the quantity to 1. Other than this guess, this may be a question for WooCommerce support because this is not about a Studio Press theme.
add_filter('woocommerce_quantity_input_args', 'default_quantity_values'); function default_quantity_values( $default ){ $default = array( 'input_name' => 'quantity', 'input_value' => '1', 'max_value' => '1000', 'min_value' => '1', 'step' => '1', ); return $default; }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 2, 2016 at 9:01 am #180444EmLY14
MemberHi Victor,
Below is what I found in my Functions.php file. Looks similar to what you mentioned. Is there an easy fix to change the code to help with the quantity display?
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 40;' ), 20 );
function woocommerce_quantity_input() {
global $product;
$defaults = array(
'input_name' => 'quantity',
'input_value' => '1',
'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ),
'min_value' => apply_filters( 'woocommerce_quantity_input_min', '', $product ),
'step' => apply_filters( 'woocommerce_quantity_input_step', '', $product ),
'style' => apply_filters( 'woocommerce_quantity_style', 'float:left; margin-right:10px;', $product )
);
if ( ! empty( $defaults['min_value'] ) )
$min = $defaults['min_value'];
else $min = 1;
if ( ! empty( $defaults['max_value'] ) )
$max = $defaults['max_value'];
else $max = 20;
if ( ! empty( $defaults['step'] ) )
$step = $defaults['step'];
else $step = 1;
$options = '';
for ( $count = $min; $count <= $max; $count = $count+$step ) {
$options .= '<option value="' . $count . '">' . $count . '</option>';
}March 3, 2016 at 12:40 pm #180550Victor Font
ModeratorComment out the function and see if it fixes your issue.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 3, 2016 at 1:49 pm #180559EmLY14
MemberThanks Victor but I dont know how to do this.
March 3, 2016 at 3:58 pm #180573Victor Font
ModeratorInsert a blank line in front of the word function and type /*. Then put */ after the closing brace. This is a php comment /* */.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 4, 2016 at 5:23 am #180635Victor Font
ModeratorIf it's any help, here's a link to a page that will help you learn about commenting code in php: http://php.net/manual/en/language.basic-syntax.comments.php
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?August 6, 2016 at 10:33 am #190833frobin
Participantfrom you cpanel access your "file manager" follow these steps and you should be able to adjust the cart size to clearly see the "quantity" in the cart.
1. Access you wp-content folder
2. Next, open your plugins folder
3. Then, open your woocommerce folder
4. Open "assets" folder
5. open "css" folder, scroll down a bit, then click on "woocommerce.css" file then at the top, click edit.
6. when that screen opens, a lot of text will appear only single spaced. *somewhere around line 17, (you can count manually,) you will see this, .quantity .qty{width:5.631em;text-align:center} change the 3 to a 5 and hit save changes.
7. Refresh your screen and the "number" in the quantity cart box will be visible. -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.