在Checkout.liquid中自定义结帐按钮
我希望在Checkout.liquid中创建自己的结帐按钮,我们目前有一个表单结帐过程,但正在遇到并发行我们的提交按钮以完成订单。我们不想使用Shopify标准结帐,因为这是一家专业商店,一切都是$ 0。运输和计费在Shopify之外完成。
这是我们目前的形式布局。
#textHead {
font-weight: bold;
padding-bottom: 8px;
padding-left: 5px;
padding-top: 10px;
}
#configHead{
padding-bottom: 8px;
padding-left: 5px;
font-weight: bold;
}
.textarea {
background: white;
border-radius: 8px;
padding-left: 5px;
padding-top: -10px;
border: solid 1px lightgray;
transition: all 0.3s ease 0s;
max-width: 100%;
}
.textarea:hover {
box-shadow: 2px 6px 25px 2px rgba(10,10,120,0.15);
transform: translateZ(-15px);
}
.strike {
display: block;
text-align: center;
overflow: hidden;
white-space: nowrap;
padding-bottom: 25px;
padding-top: 10px;
color: black;
}
.strike > span {
position: relative;
display: inline-block;
}
.strike > span:before,
.strike > span:after {
content: "";
position: absolute;
top: 50%;
width: 9999px;
height: 1px;
background: #0F4B97;
}
.strike > span:before {
right: 100%;
margin-right: 15px;
}
.strike > span:after {
left: 100%;
margin-left: 10px;
}
@import url('https://fonts.googleapis.com/css?family=Open+Sans:600');
.check {
bottom: 0;
display: flex;
left: calc(50% + 40px);
margin-bottom: 10px;
}
.containerOuter {
background: white;
border-radius: 8px;
}
.container {
position: relative;
margin: 20px;
overflow: visible;
width: 100px;
}
.hidden {
display: none;
}
.entry {
height: 25px;
position: absolute;
width: 160px;
}
.entry:nth-child(2) {
left: 8px;
top: 8px;
}
.entry:nth-child(4) {
left: 8px;
top: 58px;
}
.entry:nth-child(6) {
left: 8px;
top: 108px;
}
.circle {
border: 2px solid #545556;
border-radius: 50%;
cursor: pointer;
height: 20px;
position: absolute;
transition: border-color 300ms;
width: 20px;
}
.entry-label {
cursor: pointer;
margin-top: -3px;
padding-left: 40px;
user-select: none;
-moz-user-select: none;
}
.overlay {
background: #fff;
mask: url(#holes);
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAACMCAYAAAAOc+uVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAItSURBVHic7ZnNjhJBFIVPA0txr0Iyw+tIdOXWaDRufZWZeYbZuMKOUV9Gg+HHGN/BHBcNcSBT1KVOEVycb0mq635UVd9U5zQkif+Y3rkFclhQxYIqFlQZiM8vALQAPgP4AWC1+X0E4ALAFMBzAOPiCixjRfIdyX5g/h7JFyTnJYVKBGckHxQsxJBke2rBK5LF55bdal6fSnCmyO1JhlcyKrhkwbYekBySXNcUfF1L7o7k20jhhsxetxYAJk3T/Kks2EfXmkaHxkXO1MfacgCwmbPNjYsIftV1knzJDYgIfqsgkuJ7bkBE8FcFkRTr3IBzXxay9SOCjyuIFM8dEZxUECmeOyL4tIJIimluQKRRLwFcnqBRDwDMUaFRjwG8quC0zxtk5ACEL6wrksNaZiQfkvwZKRxtM08AfGDgBh2Q6wG4BfAo+sAxXB/xp+6VI3lzTMGSK3/Lgu1mt62fji1W+tH0m+R7dm9iZNVeMnjm9om0mUOs8O+zc47dz84Juh76DJG3NYEqeHLOfVnIYkEVC6pYUMWCKhZUsaCKBVUsqGJBFQuqWFDFgipO3OnEfRcn7qWCTtxTOHFP4cS9Ek7cVZy4qzhxL4ZO3AXoxF2QoxP3DifuW5y4q1hQxYIqFlSxoIoFVSyoYkEVC6pYUMWCKhZUsaCKE3c6cd/FiXupoBP3FE7cUzhxr4QTdxUn7ipO3IuhE3cBOnEX5OjEvcOJ+xYn7ioWVLGgigVV/gKEL4RSyM8Z8wAAAABJRU5ErkJggg==);
height: 80px;
pointer-events: none;
transition: background 300ms;
width: 40px;
}
.highlight {
background: #4D98EF;
border-radius: 50%;
height: 12px;
left: 14px;
pointer-events: none;
position: absolute;
top: 14px;
transition: transform 400ms cubic-bezier(0.175, 0.885, 0.32, 1.2);
transform: translateY(-50px);
width: 12px;
}
.hidden:nth-child(1):checked ~ .highlight {
transform: translateY(0);
}
.hidden:nth-child(3):checked ~ .highlight {
transform: translateY(50px);
}
.hidden:nth-child(5):checked ~ .highlight {
transform: translateY(100px);
}
.hidden:nth-child(1):checked + .entry .circle {
border-color: #4D98EF;
}
.hidden:nth-child(3):checked + .entry .circle {
border-color: #4D98EF;
}
.hidden:nth-child(5):checked + .entry .circle {
border-color: #4D98EF;
}
.check:checked ~ .containerOuter .overlay {
background: #ecf0f4;
}
</style>
<button type="submit" name="checkout" class="Cart__Checkout Button Button--primary Button--full">{{ 'cart.general.checkout' | t }}</button>
<form action="[email protected]" method="get">
<div class="section1">
<div class="strike">
<span>LAB SERVICES</span>
</div>
<div id="textHead">Would you like to request lab services from our technology center?</div>
<div class="containerOuter">
<div class="container">
<input type="radio" class="hidden" id="input1" name="inputs">
<label class="entry" for="input1"><div class="circle"></div><div class="entry-label">No</div></label>
<input type="radio" class="hidden" id="input2" name="inputs" checked="checked">
<label class="entry" for="input2"><div class="circle"></div><div class="entry-label">Yes</div></label>
<div class="highlight"></div>
<div class="overlay"></div>
</div>
</div>
<svg width="0" height="0" viewBox="0 0 40 140">
<defs>
<mask id="holes">
<rect x="0" y="0" width="100" height="140" fill="white" />
<circle r="12" cx="20" cy="20" fill="black"/>
<circle r="12" cx="20" cy="70" fill="black"/>
<circle r="12" cx="20" cy="120" fill="black"/>
</mask>
</defs>
</svg>
<div id="box" class="config">
<p id="textHead">Lab Configuration Instructions</p>
<textarea class="textarea" name="config-instructions" cols="75" rows="5">Combine with order #[Y/N]:
Engineer Email:
Requester Email:
PM Email:
</textarea>
</div>
</div>
<div class="strike">
<span>SHIPPING</span>
</div>
<div>
<p id="textHead">Ship To MAC:Address</p>
<p>
<input type="text" class="textarea" name="shipping-search" placeholder="MAC:Address" />
</p>
<p id="textHead">Custom Address</p>
<p>
<textarea class="textarea" name="shipping-search" placeholder="Custom Adress" cols="75" rows="5"></textarea>
</p>
<p>
<p id="textHead">Shipping Instructions</p>
<!-- <p id="textSub">Provide any specific shipping requirements for your order.</p> -->
<p>
<textarea class="textarea" name="ship-instructions" cols="75" rows="4" placeholder="Example: Forklift driver, proof of insurance required, etc"></textarea>
</p>
<p>
<p id="textHead">Shipping Method</p>
</p>
<p>
<label for="ship-method" class="textarea">
<select name="shipping-method" id="ship-method" width="50px">
<option value="UPS Ground">UPS Ground</option>
<option value="Fedex Ground">Fedex Ground</option>
</select>
</label>
</p>
<p id="textHead">Requested Arrival Date</p>
<p>
<!-- <sub>Your order's request date may be based on pre-defined working days and service level agreements related to this store</sub> -->
</p>
<input type="date" class="textarea" name="arrival" />
<p>
<b>Ship To Contact</b> <!-- (Add API call for contact lookup here if can't integrate it into ship to address - Contact Email / Phone #) -->
<br /> <sub>Main point of contact for the delivery of your order.</sub>
</p>
<p>
<input type="search" class="textarea" name="shipping-contact" placeholder="Search Contact" />
</p>
</div>
<div class="strike">
<span>BILLING</span>
</div>
<label for="billing">
<b>PO Number</b>
<br />
</label>
<sub>Point of reference for your order.</sub>
<p>
<textarea class="textarea" name="po-number" cols="25" rows="1"></textarea>
</p>
<div class="strike">
<span>ORDER INFORMATION</span>
</div>
<label for="order-info">
<b>Ordered By Contact</b>
<br />
</label>
<sub>This contact will receive a confirmation email and order status notifications depending on store access and preferences.</sub>
<p>
{{ customer.name }} | {{ customer.email }}
</p>
<label for="additional-email">
<b>Additional Confirmation Email Recipients</b>
<br />
</label>
<sub>Add additional email recipients here</sub>
<p>
<textarea class="textarea" name="add-email" cols="75" rows="1" placeholder="Seperate with a "," for multiple addresses"></textarea>
</p>
<p>
<label for="reference-number">
<b>Customer Reference Number</b>
<br />
<sub>Add any additional order identiying reference numbers</sub>
</label>
</p>
<p>
<textarea class="textarea" name="reference-number" cols="25" rows="1"></textarea>
</p>
<div class="strike">
<span>COMPLETE CHECKOUT</span>
</div>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#input1").click(function(){
$("#box").slideUp("slow");
});
$("#input2").click(function(){
$("#box").slideDown("slow");
});
});
</script>
<html>
<head>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js">
</script>
<script>
$(document).ready(function() {
$("button").click(function() {
var x = $("form").serializeArray();
$.each(x, function(i, field) {
$("#output").append(field.name + ":"
+ field.value + " ");
});
});
});
</script>
</head>
<body>
<div>
<button>Submit</button>
</div>
<div id="output"></div>
</body>
</html>```
I am looking to create my own checkout button in checkout.liquid, we currently have a form checkout process but are running into and issue with getting our submit button to complete an order. We do not want to use the shopify standard checkout since this is a specialized store and everything is $0. Shipping and billing is done outside of shopify.
Here is our current layout for our form.
#textHead {
font-weight: bold;
padding-bottom: 8px;
padding-left: 5px;
padding-top: 10px;
}
#configHead{
padding-bottom: 8px;
padding-left: 5px;
font-weight: bold;
}
.textarea {
background: white;
border-radius: 8px;
padding-left: 5px;
padding-top: -10px;
border: solid 1px lightgray;
transition: all 0.3s ease 0s;
max-width: 100%;
}
.textarea:hover {
box-shadow: 2px 6px 25px 2px rgba(10,10,120,0.15);
transform: translateZ(-15px);
}
.strike {
display: block;
text-align: center;
overflow: hidden;
white-space: nowrap;
padding-bottom: 25px;
padding-top: 10px;
color: black;
}
.strike > span {
position: relative;
display: inline-block;
}
.strike > span:before,
.strike > span:after {
content: "";
position: absolute;
top: 50%;
width: 9999px;
height: 1px;
background: #0F4B97;
}
.strike > span:before {
right: 100%;
margin-right: 15px;
}
.strike > span:after {
left: 100%;
margin-left: 10px;
}
@import url('https://fonts.googleapis.com/css?family=Open+Sans:600');
.check {
bottom: 0;
display: flex;
left: calc(50% + 40px);
margin-bottom: 10px;
}
.containerOuter {
background: white;
border-radius: 8px;
}
.container {
position: relative;
margin: 20px;
overflow: visible;
width: 100px;
}
.hidden {
display: none;
}
.entry {
height: 25px;
position: absolute;
width: 160px;
}
.entry:nth-child(2) {
left: 8px;
top: 8px;
}
.entry:nth-child(4) {
left: 8px;
top: 58px;
}
.entry:nth-child(6) {
left: 8px;
top: 108px;
}
.circle {
border: 2px solid #545556;
border-radius: 50%;
cursor: pointer;
height: 20px;
position: absolute;
transition: border-color 300ms;
width: 20px;
}
.entry-label {
cursor: pointer;
margin-top: -3px;
padding-left: 40px;
user-select: none;
-moz-user-select: none;
}
.overlay {
background: #fff;
mask: url(#holes);
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAACMCAYAAAAOc+uVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAItSURBVHic7ZnNjhJBFIVPA0txr0Iyw+tIdOXWaDRufZWZeYbZuMKOUV9Gg+HHGN/BHBcNcSBT1KVOEVycb0mq635UVd9U5zQkif+Y3rkFclhQxYIqFlQZiM8vALQAPgP4AWC1+X0E4ALAFMBzAOPiCixjRfIdyX5g/h7JFyTnJYVKBGckHxQsxJBke2rBK5LF55bdal6fSnCmyO1JhlcyKrhkwbYekBySXNcUfF1L7o7k20jhhsxetxYAJk3T/Kks2EfXmkaHxkXO1MfacgCwmbPNjYsIftV1knzJDYgIfqsgkuJ7bkBE8FcFkRTr3IBzXxay9SOCjyuIFM8dEZxUECmeOyL4tIJIimluQKRRLwFcnqBRDwDMUaFRjwG8quC0zxtk5ACEL6wrksNaZiQfkvwZKRxtM08AfGDgBh2Q6wG4BfAo+sAxXB/xp+6VI3lzTMGSK3/Lgu1mt62fji1W+tH0m+R7dm9iZNVeMnjm9om0mUOs8O+zc47dz84Juh76DJG3NYEqeHLOfVnIYkEVC6pYUMWCKhZUsaCKBVUsqGJBFQuqWFDFgipO3OnEfRcn7qWCTtxTOHFP4cS9Ek7cVZy4qzhxL4ZO3AXoxF2QoxP3DifuW5y4q1hQxYIqFlSxoIoFVSyoYkEVC6pYUMWCKhZUsaCKE3c6cd/FiXupoBP3FE7cUzhxr4QTdxUn7ipO3IuhE3cBOnEX5OjEvcOJ+xYn7ioWVLGgigVV/gKEL4RSyM8Z8wAAAABJRU5ErkJggg==);
height: 80px;
pointer-events: none;
transition: background 300ms;
width: 40px;
}
.highlight {
background: #4D98EF;
border-radius: 50%;
height: 12px;
left: 14px;
pointer-events: none;
position: absolute;
top: 14px;
transition: transform 400ms cubic-bezier(0.175, 0.885, 0.32, 1.2);
transform: translateY(-50px);
width: 12px;
}
.hidden:nth-child(1):checked ~ .highlight {
transform: translateY(0);
}
.hidden:nth-child(3):checked ~ .highlight {
transform: translateY(50px);
}
.hidden:nth-child(5):checked ~ .highlight {
transform: translateY(100px);
}
.hidden:nth-child(1):checked + .entry .circle {
border-color: #4D98EF;
}
.hidden:nth-child(3):checked + .entry .circle {
border-color: #4D98EF;
}
.hidden:nth-child(5):checked + .entry .circle {
border-color: #4D98EF;
}
.check:checked ~ .containerOuter .overlay {
background: #ecf0f4;
}
</style>
<button type="submit" name="checkout" class="Cart__Checkout Button Button--primary Button--full">{{ 'cart.general.checkout' | t }}</button>
<form action="[email protected]" method="get">
<div class="section1">
<div class="strike">
<span>LAB SERVICES</span>
</div>
<div id="textHead">Would you like to request lab services from our technology center?</div>
<div class="containerOuter">
<div class="container">
<input type="radio" class="hidden" id="input1" name="inputs">
<label class="entry" for="input1"><div class="circle"></div><div class="entry-label">No</div></label>
<input type="radio" class="hidden" id="input2" name="inputs" checked="checked">
<label class="entry" for="input2"><div class="circle"></div><div class="entry-label">Yes</div></label>
<div class="highlight"></div>
<div class="overlay"></div>
</div>
</div>
<svg width="0" height="0" viewBox="0 0 40 140">
<defs>
<mask id="holes">
<rect x="0" y="0" width="100" height="140" fill="white" />
<circle r="12" cx="20" cy="20" fill="black"/>
<circle r="12" cx="20" cy="70" fill="black"/>
<circle r="12" cx="20" cy="120" fill="black"/>
</mask>
</defs>
</svg>
<div id="box" class="config">
<p id="textHead">Lab Configuration Instructions</p>
<textarea class="textarea" name="config-instructions" cols="75" rows="5">Combine with order #[Y/N]:
Engineer Email:
Requester Email:
PM Email:
</textarea>
</div>
</div>
<div class="strike">
<span>SHIPPING</span>
</div>
<div>
<p id="textHead">Ship To MAC:Address</p>
<p>
<input type="text" class="textarea" name="shipping-search" placeholder="MAC:Address" />
</p>
<p id="textHead">Custom Address</p>
<p>
<textarea class="textarea" name="shipping-search" placeholder="Custom Adress" cols="75" rows="5"></textarea>
</p>
<p>
<p id="textHead">Shipping Instructions</p>
<!-- <p id="textSub">Provide any specific shipping requirements for your order.</p> -->
<p>
<textarea class="textarea" name="ship-instructions" cols="75" rows="4" placeholder="Example: Forklift driver, proof of insurance required, etc"></textarea>
</p>
<p>
<p id="textHead">Shipping Method</p>
</p>
<p>
<label for="ship-method" class="textarea">
<select name="shipping-method" id="ship-method" width="50px">
<option value="UPS Ground">UPS Ground</option>
<option value="Fedex Ground">Fedex Ground</option>
</select>
</label>
</p>
<p id="textHead">Requested Arrival Date</p>
<p>
<!-- <sub>Your order's request date may be based on pre-defined working days and service level agreements related to this store</sub> -->
</p>
<input type="date" class="textarea" name="arrival" />
<p>
<b>Ship To Contact</b> <!-- (Add API call for contact lookup here if can't integrate it into ship to address - Contact Email / Phone #) -->
<br /> <sub>Main point of contact for the delivery of your order.</sub>
</p>
<p>
<input type="search" class="textarea" name="shipping-contact" placeholder="Search Contact" />
</p>
</div>
<div class="strike">
<span>BILLING</span>
</div>
<label for="billing">
<b>PO Number</b>
<br />
</label>
<sub>Point of reference for your order.</sub>
<p>
<textarea class="textarea" name="po-number" cols="25" rows="1"></textarea>
</p>
<div class="strike">
<span>ORDER INFORMATION</span>
</div>
<label for="order-info">
<b>Ordered By Contact</b>
<br />
</label>
<sub>This contact will receive a confirmation email and order status notifications depending on store access and preferences.</sub>
<p>
{{ customer.name }} | {{ customer.email }}
</p>
<label for="additional-email">
<b>Additional Confirmation Email Recipients</b>
<br />
</label>
<sub>Add additional email recipients here</sub>
<p>
<textarea class="textarea" name="add-email" cols="75" rows="1" placeholder="Seperate with a "," for multiple addresses"></textarea>
</p>
<p>
<label for="reference-number">
<b>Customer Reference Number</b>
<br />
<sub>Add any additional order identiying reference numbers</sub>
</label>
</p>
<p>
<textarea class="textarea" name="reference-number" cols="25" rows="1"></textarea>
</p>
<div class="strike">
<span>COMPLETE CHECKOUT</span>
</div>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#input1").click(function(){
$("#box").slideUp("slow");
});
$("#input2").click(function(){
$("#box").slideDown("slow");
});
});
</script>
<html>
<head>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js">
</script>
<script>
$(document).ready(function() {
$("button").click(function() {
var x = $("form").serializeArray();
$.each(x, function(i, field) {
$("#output").append(field.name + ":"
+ field.value + " ");
});
});
});
</script>
</head>
<body>
<div>
<button>Submit</button>
</div>
<div id="output"></div>
</body>
</html>```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论