Home › Forums › WoodMart support forum › Increase the width of the add to cart button
Increase the width of the add to cart button
- This topic has 23 replies, 2 voices, and was last updated 8 months ago by
Hung Pham.
-
AuthorPosts
-
December 24, 2024 at 3:12 pm #625094
dhndigitalmarketingParticipantPlease guide me on how to increase the width of the add to cart button so that the product quantity increase button + add to cart button has the same size as the buy now button below.
Thank you very much
Attachments:
You must be logged in to view attached files.December 26, 2024 at 11:00 am #625420
Hung PhamKeymasterHi dhndigitalmarketing,
Thanks for reaching to us and appreciate your patience.
Please let me know if you resolved the issue by yourself.
Best regards,
December 26, 2024 at 2:30 pm #625477
dhndigitalmarketingParticipantI am still waiting for you to guide me on how to solve the problem, hope to receive support from you soon. Thank you very much
December 27, 2024 at 8:36 am #625590
Hung PhamKeymasterHi dhndigitalmarketing,
Here what I saw on my end, please double check https://ibb.co/Nr05gTH
Best regards,
December 27, 2024 at 9:16 am #625603
dhndigitalmarketingParticipantIt’s only in product preview mode on the product archive page
Attachments:
You must be logged in to view attached files.December 27, 2024 at 2:35 pm #625717
Hung PhamKeymasterHi dhndigitalmarketing,
Please add the below Custom CSS code to Theme Settings > Custom CSS > Global Custom CSS:
.popup-quick-view form.cart :where(.single_add_to_cart_button){ flex: 1 0 auto; }
Regards,
December 28, 2024 at 8:51 am #625861
dhndigitalmarketingParticipantAfter i used your css everything is fine but i have question that in elementor i selected ‘full width button’ for ‘add to cart’ button but it only shows full width in most of the screen ratio, but on a few billion screens and in product previews it only takes up a portion of the width, not the entire width. I hope you can help me explain this question, thank you very much
Attachments:
You must be logged in to view attached files.December 30, 2024 at 10:27 am #626098
Hung PhamKeymasterHi dhndigitalmarketing,
Thanks for your patience.
It looked very well on my end, please double check https://ibb.co/Vv5DYcY
Regards,
December 31, 2024 at 3:09 am #626361
dhndigitalmarketingParticipantNow everything is fine, the problem I asked above was solved with the css, but without the css it will have the problem as I mentioned above, Is there any setting in elementor or in theme settings that can solve this problem without using css?
best regards
December 31, 2024 at 1:12 pm #626430
Hung PhamKeymasterHi dhndigitalmarketing,
Unfortunately, there is no such option by default. Please use CSS instead.
Best Regards
January 5, 2025 at 8:25 am #627415
dhndigitalmarketingParticipantCurrently there is a problem: in the product preview and in the single product page, if the product has all the attributes selected, the new ‘buy’ button is below and has the same length as the ‘product quantity increase or decrease button’ + ‘add to cart button’. If you click the clear attributes button, the add to cart and buy now buttons will be smaller and located on the same row.
I would like to repeat the design so you can easily recall and visualize:
– Place the add/subtract product quantity button and add to cart button on the same line.
– Place the buy button right below and have a width equal to the total width of the two buttons above.
– These buttons can be automatically scaled or increased or decreased in size to be consistent on all devices and all screen ratios.
I want the design to be consistent when the product does not select any attributes and when the product has selected attributes. Please help me implement this design on preview and single product page
Hope you can help me, thank you in advance
Attachments:
You must be logged in to view attached files.January 6, 2025 at 9:08 am #627488
Hung PhamKeymasterHello dhndigitalmarketing,
Thanks for your patience.
Please replace below code:
.woocommerce-variation-add-to-cart.variations_button.woocommerce-variation-add-to-cart-enabled button#wd-add-to-cart { width: 100%; }
with:
button.wd-buy-now-btn{ width: 100%; }
Best Regards,
January 6, 2025 at 3:34 pm #627675
dhndigitalmarketingParticipantI deleted the 2 old css codes I sent and replaced them with your 2 new css codes but in the product preview the ‘add to cart’ button does not display all the space but only half.
Best Regards.
Attachments:
You must be logged in to view attached files.January 7, 2025 at 10:53 am #627883
Hung PhamKeymasterHello dhndigitalmarketing,
Please replace below code:
button.wd-buy-now-btn{ width: 100%; } .product-quick-view form.cart :where(.single_add_to_cart_button) { flex: 1 0 auto; }
Regards,
January 8, 2025 at 8:12 am #628136
dhndigitalmarketingParticipantI succeeded, thank you very much. By the way, can you help me annotate the meaning of each code segment, so that later when I look at the Global custom CSS section, I can easily distinguish it.
Best Regards.
January 8, 2025 at 9:24 am #628152
Hung PhamKeymasterHello dhndigitalmarketing,
Please replace below code:
/* Adjusting width of buy now button in both preview and single product */ button.wd-buy-now-btn{ width: 100%; } /* Adjusting width of buy now button in preview only */ .product-quick-view form.cart :where(.single_add_to_cart_button) { flex: 1 0 auto; }
Regards,
January 9, 2025 at 2:58 am #628445
dhndigitalmarketingParticipantLet me ask if you have any confusion about the meaning of the css code snippets, because I see that the content of both snippets is about the buy now button.
And by the way, may I ask why I haven’t received notifications via gmail for the last 2 replies? But when I came here, I saw that the question had already been answered.
Best Regards.
January 9, 2025 at 11:14 am #628489
Hung PhamKeymasterHello dhndigitalmarketing,
The first code is used for both buy now button in Preview and single products, while the second is used for preview section only.
Regards,
January 9, 2025 at 2:44 pm #628572
dhndigitalmarketingParticipantI still have a little question, I hope you can explain to me why the first code has the function of ‘adjusting the width of the buy now button in both the preview and the single product’ but the second code repeats the function of ‘adjusting the width of the buy now button in the preview’ that is already in the first css.
And I wonder if the content of the function of the second paragraph is to adjust the width of the ‘buy now’ button, but in the css content I see (.single_add_to_cart_button), it seems that this button is about the shopping cart button. Because I’m new to website development, I’m not very familiar with css, so I’m wondering if you can sympathize and explain it to me. Thank you very much.January 13, 2025 at 10:40 am #629166
Hung PhamKeymasterHello dhndigitalmarketing,
Thanks for your patience.
Sorry, but your question is a bit unclear to me. Please describe in more details, this will allow me to thoroughly investigate and address your concerns in a more efficient.
Regards,
January 14, 2025 at 3:28 am #629447
dhndigitalmarketingParticipantQuestion 1: My question is:
/* Adjusting width of buy now button in both preview and single product */
/* Adjusting width of buy now button in preview only */
Your 2 css annotations both talk about adjusting the width of the buy now button, I wonder why one buy now button needs 2 css paragraphs.
Question 2:
/* Adjusting width of buy now button in preview only */
.product-quick-view form.cart :where(.single_add_to_cart_button) {
flex: 1 0 auto;
}And in the css paragraph you sent me, the content of the paragraph is about the buy now button but I see the content in the paragraph talks about the add to cart button so I feel a bit confused.
I’m not very familiar with css so I hope you will sympathize and explain to me. Thank you very much.
January 14, 2025 at 9:40 am #629482
Hung PhamKeymasterHello dhndigitalmarketing,
It’s hard to describe exactly, but few rules can be applied for many or same elements across site. Hope it clears.
Regards,
January 15, 2025 at 3:05 am #629788
dhndigitalmarketingParticipantOk i understand, i will dig deeper into this issue to know the specific cause, i just want to be sure so i ask again:
/* Adjusting width of buy now button in both preview and single product */
button.wd-buy-now-btn{
width: 100%;
}/* Adjusting width of buy now button in preview only */
.product-quick-view form.cart :where(.single_add_to_cart_button) {
flex: 1 0 auto;
}the content describing the function of the 2 css segments is completely correct, right. Because i am a bit picky so i ask again and again to be sure, i apologize if this makes you uncomfortable. thank you very much
January 15, 2025 at 2:34 pm #629934
Hung PhamKeymasterHello dhndigitalmarketing,
Yes, it’s true.
Regards,
-
AuthorPosts
- You must be logged in to create new topics. Login / Register