Archived topic
change justify setting for div.quantity.buttons-added in mobile
7 replies · Started by Heinrich on June 2, 2022
hi team,
struggling with adressing the correct class to change the justify-content setting which is in mobile: flex-end, i want to have it centered in mobile too. thought it has to be "div.quantity.buttons-added" but i cannot address this class. the whole thing is about the quantity buttons.
can you please have a look and give me a hint?
Hi there,
what element exactly are you trying to change ?
The div.quantity.buttons-added container is for the Quantity Buttons on a single product - but i don't see them on your products ?
hi david,
we show this on the archive as you can see on the link i sent you. and on archive in mobile i habe the problem.
the snippet we use to show quantity on archive is:
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
$html .= '</form>';
}
return $html;
}
I don't see them on the link you provided as is see this:
You must log in before you can shop with us.
Continue reading
ah, you have to be logged in. i send you the credentials
Hi Heinrich,
Here’s a CSS you may try adding in Appearance > Customize > Additional CSS to address the issue:
@media (max-width: 768px) {
.products .quantity.buttons-added {
justify-content: center;
}
}
Kindly let us know how it goes!
perfect, tks
You’re welcome Heinrich!