Jump to content

ADD TO CART BUTTON next to Variants

Recommended Posts

Anyone would give some help / advice how I could put purchase now (ADD TO CART BUTTON) next to SIZE & CARAT. In other words, that all of them would be in one line.

Ideally I want the buttons resize dynamically (purchase now button is pushed down on a smaller screen, etc.)

The link: https://rocksforlife.com/
Pass: rocksfor.life

Maybe some of you lovely people would be able to give me a hand?


 

Screenshot 2021-05-27 at 09.32.45.png

Link to comment
52 minutes ago, creedon said:

Password works.

Would you ever have a quantity field on one of your products? Knowing this might change how we approach a solution.

As of now, quantity field would not be required.

However, would equally be happy to learn the approach when quantity field becomes relevant.

Link to comment

Add the following to Store Settings > Advanced > Page Header Code Injection for the store page.

<style>

  /*
  
    begin display add to cart button to right of variants
    
    Version     : 0.1d3
    
    SS Version  : 7.0
    
    Template    : Brine ( Aria, Blend, Cacao, Clay, Fairfield, Feed, Foster,
                  Greenwich, Hatch, Heights, Hunter, Hyde, Impact, Jaunt, Juke,
                  Keene, Kin, Lincoln, Maple, Margot, Marta, Mentor, Mercer,
                  Miller, Mojave, Moksha, Motto, Nueva, Pedro, Pursuit, Rally,
                  Rover, Royce, Sofia, Sonora, Stella, Thorne, Vow, Wav, West )
                  
                  your template is not listed? then it is not currently
                  supported
                  
    Note        : this effect is designed to work with stores where all product
                  items have a quantity of only one in stock. in other words the
                  effect will break as soon as the quantity field shows for a
                  product item
    
    By          : Thomas Creedon < http://www.tomsWeb.consulting/ >
    
    no user serviceable parts below
    
    */
    
    .ProductItem-details:last-child {
    
      display : block;
      
      }
      
    .tweak-product-item-details-show-add-to-cart-button .ProductItem-details .product-variants,
    .tweak-product-item-details-show-variants .ProductItem-details .product-variants
    
      {
      
        float : left;
        margin : 0;
        
        }
        
    .ProductItem-details .variant-option {
    
      margin-left : 0;
      margin-right : 26px;
      
      }
      
    .ProductItem-details .variant-option-title {
    
      display : none;
      
      }
      
    .ProductItem-details .sqs-add-to-cart-button-wrapper {
    
      min-width : unset !important;
      width : unset !important;
      
      }
      
    .ProductItem-details .sqs-add-to-cart-button {
    
      display : inline-block !important;
      
      }
      
    /* end display add to cart button to right of variants */
    
  </style>

Let us know how it goes.

Edited by creedon
version 0.1d3

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
Quote

However, would equally be happy to learn the approach when quantity field becomes relevant.

Before you need the quantity field hit us up. It would require different code to work with a quantity field.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
5 hours ago, creedon said:

Add the following to Store Settings > Advanced > Page Header Code Injection for the store page.


<style>

  /*

    begin move add to cart button to right of variants
  
    Version     : 0.1d0
  
    SS Version  : 7.0
  
    Template    : Brine ( Aria, Blend, Cacao, Clay, Fairfield, Feed, Foster,
                  Greenwich, Hatch, Heights, Hunter, Hyde, Impact, Jaunt, Juke,
                  Keene, Kin, Lincoln, Maple, Margot, Marta, Mentor, Mercer,
                  Miller, Mojave, Moksha, Motto, Nueva, Pedro, Pursuit, Rally,
                  Rover, Royce, Sofia, Sonora, Stella, Thorne, Vow, Wav, West )
                  
                  your template is not listed? then it is not currently
                  supported
                  
    Note        : this effect is designed to work with stores where all product
                  items have a quantity of only one in stock. in other words the
                  effect will break as soon as the quantity field shows for a
                  product item
    
    By          : Thomas Creedon < http://www.tomsWeb.consulting/ >
  
    */
    
    :root {
    
      --grid-gap : 1rem;
      
      }
      
    /* do not change anything below, there be the borg here */
    
    .ProductItem-details  > *,
    .ProductItem-details .variant-option
    
      {
      
        margin : 0 !important;
        
        }
        
    .ProductItem-details .variant-option-title {
    
      display : none;
      
      }
      
    .tweak-product-item-details-show-add-to-cart-button .ProductItem-details .product-variants,
    .tweak-product-item-details-show-variants .ProductItem-details .product-variants
    
      {
      
        display : grid;
        gap : var( --grid-gap );
        grid-template-columns : 1fr 1fr;
        
        }
        
    .ProductItem-details:last-child {
    
      display : grid;
      gap : var( --grid-gap );
      grid-template-columns : repeat( 8, 1fr );
      
      }
      
    .ProductItem-details > * {
    
      grid-column : 1 / 9;
      
      }
      
    .ProductItem-details .product-variants {
    
      grid-column : 1 / 6;
      
      }
      
    .ProductItem-details .sqs-add-to-cart-button-wrapper {
    
      grid-column : 6 / 9;
      
      }
      
    /* end move add to cart button to right of variants */
    
  </style>

Let us know how it goes.

Thank you - that worked like a charm! However, two issues now:

1. When there is only one variant, how I can push the PURCHASE NOW button closer (reference 1)? 

2. How could I make SIZE & CARAT buttons with less space (reference 2)?

 

Screenshot 2021-05-30 at 10.14.11.png

Screenshot 2021-05-30 at 09.08.18.png

Link to comment
Quote

2. How could I make SIZE & CARAT buttons with less space (reference 2)?

After trying the new code if you still need less space between buttons let us know. I didn't do anything in my code to address the issue. I want get the first effect working before moving onto other issues.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
1 hour ago, creedon said:

After trying the new code if you still need less space between buttons let us know. I didn't do anything in my code to address the issue. I want get the first effect working before moving onto other issues.

That worked and resolved the second question!! Thanks so much!

There is one more thing though. When I click purchase button, those two, however, overlap. Any insights on this?

https://rocksforlife.com/our-jewellery/no-1-solitaire-ring-white-gold

 

Screenshot 2021-05-30 at 22.53.35.png

Link to comment
On 5/31/2021 at 12:05 AM, creedon said:

I have updated my code post again.

Let us know how it goes.

Would you be able to have a second look for mobile screen, @creedon? The button hops onto the second line once there is a longer text in it, however they are not all in alignment. I would like to remove that left margin and display them in 1x 3 ( separate in each line)
 

IMG_3150.PNG

Link to comment
  • 4 months later...
On 5/31/2021 at 12:05 AM, creedon said:

I have updated my code post again.

Let us know how it goes.

Hi, @creedon!
Any chance you would be able to give a hand to pushing the price title above quantity and add to cart to button? I find it a little challenging task due to the code we added earlier this year to the site.

Example: https://rocksforlife.com/our-jewellery/double-pav-hoop-large-white-gold

Link to comment
2 hours ago, creedon said:

Please see Store Product Details Reorder Desktop. You will notice that the Quick Install instructions will direct you to install other code several layers deep. You will be building up code to get the final effect.

Let us know how it goes.

Hmm ..

I added this piece of code to the store page, however, no changes are visible. The site is built on 7.0 ..

 

<style>
   
  /*
   
  begin store product details reorder desktop
   
  Version : 0.1d0
   
  SS Version : 7.1
   
  Dependancies : store product details display flex desktop
   
  By : Thomas Creedon < http://www.tomsWeb.consulting/ >
   
  */
   
  @media screen and ( min-width : 768px ) {
   
  .ProductItem-details .ProductItem-details-checkout {
   
  /* this is where you control the order of elements. replace unset with a
  number. use 1, 2, 3, etc. */
   
  --add-to-cart-button : 3;
  --description : 1;
  --price : 4;
  --quantity : unset;
  --variants :2;
   
  }
   
  /* do not change anything below, there be the borg here */
   
  .ProductItem-details .product-quantity-input {
   
  -webkit-box-ordinal-group : calc( var( --quantity ) + 1 );
  -moz-box-ordinal-group : calc( var( --quantity ) + 1 );
  -ms-flex-order : var( --quantity );
  -webkit-order : var( --quantity );
  order : var( --quantity );
   
  }
   
  .ProductItem-details .product-variants {
   
  -webkit-box-ordinal-group : calc( var( --variants ) + 1 );
  -moz-box-ordinal-group : calc( var( --variants ) + 1 );
  -ms-flex-order : var( --variants );
  -webkit-order : var( --variants );
  order : var( --variants );
   
  }
   
  .ProductItem-details .ProductItem-details-excerpt {
   
  -webkit-box-ordinal-group : calc( var( --description ) + 1 );
  -moz-box-ordinal-group : calc( var( --description ) + 1 );
  -ms-flex-order : var( --description );
  -webkit-order : var( --description );
  order : var( --description );
   
  }
   
  .ProductItem-details .ProductItem-product-price {
   
  -webkit-box-ordinal-group : calc( var( --price ) + 1 );
  -moz-box-ordinal-group : calc( var( --price ) + 1 );
  -ms-flex-order : var( --price );
  -webkit-order : var( --price );
  order : var( --price );
   
  }
   
  .ProductItem-details .sqs-add-to-cart-button-wrapper {
   
  -webkit-box-ordinal-group : calc( var( --add-to-cart-button ) + 1 );
  -moz-box-ordinal-group : calc( var( --add-to-cart-button ) + 1 );
  -ms-flex-order : var( --add-to-cart-button );
  -webkit-order : var( --add-to-cart-button );
  order : var( --add-to-cart-button );
   
  }
   
  }
   
  /* end store product details reorder desktop */
   
  </style>
 
Link to comment
On 11/2/2021 at 10:11 PM, creedon said:

My bad. The code I pointed to is only for v7.1. Please remove that code.

Let me see if I have some code around here to do the job.

Thomas @creedon, any chance you might be able to share some knowledge how the reorder of the product details can be achieved making the quantity & add to cart buttons to stay in one row?

Link to comment
On 11/7/2021 at 8:22 PM, ievavi said:

Thomas @creedon, any chance you might be able to share some knowledge how the reorder of the product details can be achieved making the quantity & add to cart buttons to stay in one row?

Have you solved it yet?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.