Jump to content

Moving a button next to Shopify buy buttons

Recommended Posts

Site URL: https://www.tgtfresh.com/fresh/p/longan

I've added buttons linking an alternative store for most of my product pages using tags and css/code injection, however, I haven't been able to move the button next to the Shopify buy button. Is there a way to do this?

I'm trying to make them look like this:No description available.

 

The Shopify buy buttons were moved from Additional Information code blocks using this:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function() { 
		$('section.ProductItem-details .code-block').insertAfter('.ProductItem-details .ProductItem-product-price');
	});
</script>

The buttons linking an alternative store were added using this in header:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
   <script>
   $(function() {
     $("<a class='cvsbutton' target='_blank' data-initialized='true' href='https://myship.7-11.com.tw/general/detail/GM2208088428146'>7-11 低溫賣場</a>").insertAfter(".tag-available .code-block");        
   });
</script>

and this:

.cvsbutton {
 order: 4 !important;
 font-family: arial;
 font-size: 15px;
 color: #fff;
 font-weight: normal;
 font-style: normal;
 text-align: center;
 width: 100px;
 border-radius: 3px; 
 text-decoration: none;
 padding: 10px 10px;
 background-color: #FF8A43;
}
.checkoutbutton:hover {
 color: #fff;
 background-color: #d49999;
}
Edited by L1NST3R
Link to comment
  • Replies 2
  • Views 239
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Combine first, second code to this

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function() { 
		$('section.ProductItem-details .code-block').insertAfter('.ProductItem-details .ProductItem-product-price');
$("<a class='cvsbutton' target='_blank' data-initialized='true' href='https://myship.7-11.com.tw/general/detail/GM2208088428146'>7-11 低溫賣場</a>").appendTo(".shopify-buy-frame");
	});
</script>
<style>
.shopify-buy-frame--product {
    max-width: 500px !important;
    display: flex;
}
</style>

 

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
5 hours ago, tuanphan said:

Combine first, second code to this

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function() { 
		$('section.ProductItem-details .code-block').insertAfter('.ProductItem-details .ProductItem-product-price');
$("<a class='cvsbutton' target='_blank' data-initialized='true' href='https://myship.7-11.com.tw/general/detail/GM2208088428146'>7-11 低溫賣場</a>").appendTo(".shopify-buy-frame");
	});
</script>
<style>
.shopify-buy-frame--product {
    max-width: 500px !important;
    display: flex;
}
</style>

 

Thanks for the response! I wasn't sure where to place/replace the code, so I did so once each for the Additional Info code block and the header injection, then both of them together after, but none of these  seemed to have changed anything. Is there somewhere else where I'm supposed to put this code in, or were there some previous codes that I should've deleted? Thanks!

(I had to change the tag to "roomtemp" as well as the button text to "7-11 常溫賣場" and link to "https://myship.7-11.com.tw/seller/profile?id=GM2208098456054", but I've made changes to the codes accordingly)

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.