Skip cart and go directly to checkout (Habitat theme)

Skip cart and go directly to checkout (Habitat theme)

amepro
Visitor
2 0 0

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?

 

Site is: https://www.littlebird.care/products/reserve

Replies 3 (3)

PaulNewton
Shopify Partner
7536 666 1592

 


@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


amepro
Visitor
2 0 0

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.

PaulNewton
Shopify Partner
7536 666 1592

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