Personalized checkout and custom promotions with Shopify Scripts
Hi, I've been looking for a code workaround to skip the cart entirely and go directly to checkout when someone clicks "Buy Now" – I could create a checkout permalink, however we do want folks to still be able to change the quantity. I'm able to find solutions for the Dawn theme, but I'm looking specifically for the Habitat theme. Have you done this?
@amepro wrote:however we do want folks to still be able to change the quantity
This directly counters what your asking to be able to do, customers cannot edit quantities in the checkout.
Regardless,
Double check for a related theme settings, and that themes support docs, or support email.
If you are using dynamic checkout buttons it should take them directly to checkout.
https://help.shopify.com/en/manual/online-store/dynamic-checkout/dynamic-checkout
Beyond that you may need to customize either the product form or the themes javascript to send customers directly to checkout.
If you need this customization then contact me by my email for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Sorry this was confusing! We want them to be able to change the quantity before they click "buy now" – so creating a checkout permalink and adding a button to bypass the cart doesn't really work out.
Ah it is possible to do with cart adds redirected to the checkout instead of permalinks(they have a different parameter format) but you have to either use javascript or build a specific form with it's own quantity input to send them to the generated permalink url with the right quantity.
For products with a single/default variant:
{% assign product = all_products['YOUR-PRODUCT-HANDLE-HERE'] %}
{%- assign product_form_id = 'product-form-' | append: section.id-%}
{%- form 'product',
product,
id: product_form_id,
class: 'form',
novalidate: 'novalidate',
data-type: 'add-to-cart-form'
-%}
<input
type="hidden"
name="id"
value="{{ product.selected_or_first_available_variant.id }}"
/>
<input
type="hidden"
name="return_to"
value="/checkout"
/>
<input
type="number"
name="quantity"
value=1
/>
<button
id = "ProductSubmitButton-{{ section_id }}"
type="submit"
name="add"
class=""
{% if product.selected_or_first_available_variant.available == false %}
disabled
{% endif %}
>
Add To Cart Button
{% if product.selected_or_first_available_variant.available == false %}
(product not available)
{% endif %}
</button>
{%- endform -%}
If there's multiple variants you need to add a variant selector to the form
https://shopify.dev/docs/themes/architecture/templates/product#the-product-form
Permalinks format: https://shopify.dev/docs/apps/checkout/cart-permalinks/cart-permalinks
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024