Payment icons underneath "buy now button" alligned straight

Solved

Payment icons underneath "buy now button" alligned straight

WVU
Excursionist
40 0 7

Dear,

I'd like to allign my payment icons underneath the buy now button on the product page (mobile version) in 1 line.
They are in 2 rows now, see:

WVU_0-1740127392756.png


I am using this piece of custom liquid to display them.
What code needs to be added in order to display the icons all on the same line instead of 2 (only on mobile).

<style>
.icon-list-custom {
display: flex;flex-wrap: wrap;
list-style: none;justify-content: left;
margin: 7.5rem; gap:10px;
padding: 1px ;margin-top: -1rem; margin-bottom: -1rem;} </style>
<ul class="icon-list-custom" role="list">
{% assign enabled_payment_types = 'ideal,klarna,visa, master, american_express,vvv_giftcard' | remove: ' ' | split: ',' %}
{% for type in enabled_payment_types %}
<li>{{ type | payment_type_svg_tag: class: 'icon-svg' }} </li>
{%- endfor -%}
</ul>


I am using the dawn theme, and web URL: https://utrecht-winkel.nl/

Thanks a lot!

Accepted Solution (1)

thescriptflow
Shopify Partner
381 26 56

This is an accepted solution.

Hey @WVU there is typo in your code that prevent payment icons to show in one line.
Please remove the margin and remove flex-wrap property in the code.
Here is updated code:

<style>
.icon-list-custom {
 display: flex;
 list-style: none;
 justify-content: left;
 gap:10px;
 padding: 1px;
 margin-top: -1rem;
 margin-bottom: -1rem;
}
 </style>

After Applying this code it look like this:

qasimdevloper_0-1740128324172.png

If you want to make the payment icons in center then Choose this code instead of previous one:

<style>
.icon-list-custom {
 display: flex;
 list-style: none;
 justify-content: left;
 gap:10px;
 padding: 1px;
 margin-top: -1rem;
 margin-bottom: -1rem;
 justify-content: center;
}
 </style>

After that it will look like this:

qasimdevloper_1-1740128412601.png

But when you see it Under 750px Responsiveness then it look like this. The payment icons in center.

qasimdevloper_2-1740128475943.png

If you want to show payment icons in left under 750px width devices then Choose this code instead of all previous one.

<style>
.icon-list-custom {
 display: flex;
 list-style: none;
 justify-content: center;
 gap:10px;
 padding: 1px;
 margin-top: -1rem;
 margin-bottom: -1rem;
}
@media only screen and (max-width: 750px){
.icon-list-custom{
 justify-content: flex-start;
}
}
 </style>

After that it look like under 750px width mean on mobile Devices.

qasimdevloper_3-1740128652577.png

If this was really helpful then prove it by "Like" and "Mark as Solution".
Want to hire me? Details shared in Signature.

 

- Need a Shopify Specialist? Chat on WhatsApp +447828078063

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


- If my solution was helpful, mark it as a solution and hit the like button!

View solution in original post

Replies 8 (8)

thescriptflow
Shopify Partner
381 26 56

This is an accepted solution.

Hey @WVU there is typo in your code that prevent payment icons to show in one line.
Please remove the margin and remove flex-wrap property in the code.
Here is updated code:

<style>
.icon-list-custom {
 display: flex;
 list-style: none;
 justify-content: left;
 gap:10px;
 padding: 1px;
 margin-top: -1rem;
 margin-bottom: -1rem;
}
 </style>

After Applying this code it look like this:

qasimdevloper_0-1740128324172.png

If you want to make the payment icons in center then Choose this code instead of previous one:

<style>
.icon-list-custom {
 display: flex;
 list-style: none;
 justify-content: left;
 gap:10px;
 padding: 1px;
 margin-top: -1rem;
 margin-bottom: -1rem;
 justify-content: center;
}
 </style>

After that it will look like this:

qasimdevloper_1-1740128412601.png

But when you see it Under 750px Responsiveness then it look like this. The payment icons in center.

qasimdevloper_2-1740128475943.png

If you want to show payment icons in left under 750px width devices then Choose this code instead of all previous one.

<style>
.icon-list-custom {
 display: flex;
 list-style: none;
 justify-content: center;
 gap:10px;
 padding: 1px;
 margin-top: -1rem;
 margin-bottom: -1rem;
}
@media only screen and (max-width: 750px){
.icon-list-custom{
 justify-content: flex-start;
}
}
 </style>

After that it look like under 750px width mean on mobile Devices.

qasimdevloper_3-1740128652577.png

If this was really helpful then prove it by "Like" and "Mark as Solution".
Want to hire me? Details shared in Signature.

 

- Need a Shopify Specialist? Chat on WhatsApp +447828078063

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


- If my solution was helpful, mark it as a solution and hit the like button!

WVU
Excursionist
40 0 7

Hi Qasim,

That is absolutely awesome, thank you for your quick reply and offered solution!

thescriptflow
Shopify Partner
381 26 56

I am very happy that I could help.

- Need a Shopify Specialist? Chat on WhatsApp +447828078063

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


- If my solution was helpful, mark it as a solution and hit the like button!

WVU
Excursionist
40 0 7

Hi Qasim,

Upon refreshing my product page, it seems like the payment icons are alligned right instead of in the center.
I have used this code:
<style>
.icon-list-custom {
display: flex;
list-style: none;
justify-content: center;
gap:10px;
padding: 1px;
margin-top: -1rem;
margin-bottom: -1rem;
}
@media only screen and (max-width: 750px){
.icon-list-custom{
justify-content: flex-start;
}
}
</style>

Why is it not in the center?

WVU
Excursionist
40 0 7

I would like the payment icons to be in the center for both mobile and desktop. 
I appreciate your help. Is it possible to send an updated code? Or am I doing something wrong?
Much appreciated, and thanks in advance!

Desktop view:

WVU_0-1740129867698.png

 

thescriptflow
Shopify Partner
381 26 56

Consider Refrsh your Website Again.
If it also look like in right then Open the same URL in "Incognito Mode".
If you seem that it also show payment icons in Right instead of Center then remove the Previous code and paste the following code.

<style>
.icon-list-custom {
display: flex;
list-style: none;
justify-content: center !important;
gap:10px;
padding: 1px;
margin-top: -1rem;
margin-bottom: -1rem;
}
@media only screen and (max-width: 750px){
.icon-list-custom{
justify-content: center !important;
}
}
</style>

After that it look like on Dektop:

qasimdevloper_1-1740130505169.png

 

And Look like this on Mobile:

qasimdevloper_0-1740130469114.png

- Need a Shopify Specialist? Chat on WhatsApp +447828078063

- Boost Your Sales with Affiliate Marketing - UpPromote: Affiliate & Referral


- If my solution was helpful, mark it as a solution and hit the like button!

WVU
Excursionist
40 0 7

Hi Qasim,

Even upon pasting your new code, the icons still show right..

WVU_0-1740131113320.png

 

WVU
Excursionist
40 0 7

It seems like there is some 'blank' margin next to the buy buttons which don't allow it to allign it properly.
Any way to get rid of this dead space?

WVU_0-1740131448307.png