Shopify themes, liquid, logos, and UX
I've figured out how to add the product price to my Add to Cart button (using this guide), but it's currently displaying as "Add to Cart$xx.xx" with no space between the "Add to Cart" and "$xx.xx"
How can I add a space in here? I figured out how to change the default theme content from "Add to Cart" to "Add to Cart:" to add a colon (or a dash or whatever), but any spaces added after the colon are removed.
My current code where it calls the text to display looks like this:
Solved! Go to the solution
This is an accepted solution.
Hi @hideandscratch,
Please change code:
<span class="ezfyButtonPrice">{{ product.selected_or_first_available_variant.price | money }}</span>
=>
<span class="ezfyButtonPrice" style="padding-left: 5px;">{{ product.selected_or_first_available_variant.price | money }}</span>
Hello @hideandscratch
Our team is ready to help you.
Please share your website address and access password (if necessary) so that we can check and assist you.
If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
Salepify: Efficiently increase sales conversion with sale-driven features like auto add to cart, free gifts (free plan available)
BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month nowHi @hideandscratch , kindly share your store URL. Thanks!
This is an accepted solution.
Hi @hideandscratch,
Please change code:
<span class="ezfyButtonPrice">{{ product.selected_or_first_available_variant.price | money }}</span>
=>
<span class="ezfyButtonPrice" style="padding-left: 5px;">{{ product.selected_or_first_available_variant.price | money }}</span>
THANK YOU!!! I knew it was something easy!
Hi @hideandscratch,
If you have any questions, you can contact me directly.
Nice to meet you 😊
Hi @hideandscratch ,
To fix the issue with the missing space between "Add to Cart" and the price, you can modify the code where the button text is set. Based on your description, the space is likely being removed due to how the code is structured. Here's how you can add a space:
Find the part of your code that sets the button text, which probably looks something like this:
html
{{ 'Add to Cart' }}{{ product.price | money }}
To ensure there's a space between "Add to Cart" and the price, modify it as follows:
html
{{ 'Add to Cart ' }}{{ product.price | money }}
Notice the space between 'Add to Cart ' and {{ product.price | money }}.
If you're appending the price in JavaScript, you can add the space in the string directly like this:
javascript
button.innerHTML = 'Add to Cart ' + productPrice;
Let me know if you need help applying this in your specific theme or setup!
Hyelladi
Return Prime
@hideandscratch , you can add after this
this code
It will add a space for your add to cart button
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024